xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 3.12KB
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發布日期: 2021-02-28
  • 標簽: HTML??php??靜態緩存??

資源簡介


thnkphp5行為擴展html靜態緩存

利用鉤子thinkphp鉤子進行行為擴展。先上本地測試結果


關閉緩存:

[email protected] */" _ue_custom_node_="true">:/home/www/wwwroot/yunshare.qq$ ab -n1000 -c10 http://yunshare.qq/Article/8/9.html
This is ApacheBench, Version 2.3 
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking yunshare.qq (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        nginx/1.10.0
Server Hostname:        yunshare.qq
Server Port:            80

Document Path:          /Article/8/9.html
Document Length:        67926 bytes

Concurrency Level:      10
Time taken for tests:   66.869 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      68095000 bytes
HTML transferred:       67926000 bytes
Requests per second:    14.95 [#/sec] (mean)
Time per request:       668.692 [ms] (mean)
Time per request:       66.869 [ms] (mean, across all concurrent requests)
Transfer rate:          994.46 [Kbytes/sec] received

Connection Times (ms)
              min  mean[ /-sd] median   max
Connect:        0    0   0.2      0       3
Processing:   252  666  72.9    661    1066
Waiting:      252  664  72.5    659    1065
Total:        255  666  72.9    661    1066

Percentage of the requests served within a certain time (ms)
  50%    661
  66%    687
  75%    704
  80%    716
  90%    757
  95%    792
  98%    834
  99%    858
 100%   1066 (longest request)

開啟緩存:

[email protected] */" _ue_custom_node_="true">:/home/www/wwwroot/yunshare.qq$ ab -n1000 -c10 http://yunshare.qq/Article/8/9.html
This is ApacheBench, Version 2.3 
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking yunshare.qq (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        nginx/1.10.0
Server Hostname:        yunshare.qq
Server Port:            80

Document Path:          /Article/8/9.html
Document Length:        44835 bytes

Concurrency Level:      10
Time taken for tests:   20.578 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      45004000 bytes
HTML transferred:       44835000 bytes
Requests per second:    48.60 [#/sec] (mean)
Time per request:       205.777 [ms] (mean)
Time per request:       20.578 [ms] (mean, across all concurrent requests)
Transfer rate:          2135.77 [Kbytes/sec] received

Connection Times (ms)
              min  mean[ /-sd] median   max
Connect:        0    0   0.1      0       2
Processing:    69  205  30.7    202     344
Waiting:       68  202  30.3    200     340
Total:         71  205  30.6    202     344

Percentage of the requests served within a certain time (ms)
  50%    202
  66%    213
  75%    220
  80%    224
  90%    239
  95%    254
  98%    286
  99%    328
 100%    344 (longest request)


使用方法(和thinkphp3.2相似)

 '配置值'
    'html_cache_on' => false, // 開啟靜態緩存
    'html_cache_time' => 7200, // 全局靜態緩存有效期(秒)
    'html_file_suffix' => '.shtml', // 設置靜態緩存文件后綴
    'html_cache_compile_type' => 'file',//緩存存儲驅動
    'html_cache_rules' => array( // 定義靜態緩存規則
    // // 定義格式1 數組方式
    //'靜態地址' => array('靜態規則', '有效期', '附加規則'),
    //1.任意控制器的任意操作都適用
    '*'=>array('{$_SERVER.REQUEST_URI|md5}'),
    //2.任意控制器的md5操作
    'md5'=>array('{:module}/{:controller}/{:action}_{id|md5}'),
    //3.Static控制器的所有操作
    'Static:'=>array('{:module}/{:controller}/{:action}',50)//第一個參數是構造的字符串,后面是緩存50秒
    //4.Hmtl控制器的md5操作
    'Html:md5'=>array('{:module}/{:controller}/{:action}'),
 )
);

參考:http://wp.iyouths.org/250.html




擴展步驟

  • 文件位置:appplication/tags.php(或appplication/index/tags.php)

 [
        'app\\index\\behavior\\ReadHtmlCacheBehavior',//可自行修改文件位置
    ],
    'view_filter' => [
        'app\\index\\behavior\\WriteHtmlCacheBehavior',
    ],
];


  • 添加文件

application/index/behavior/ReadHtmlCacheBehavior.php

application/index/behavior/WriteHtmlCacheBehavior.php


注意:

檢查是否修改模板文件改為了app_debug = true


資源截圖

代碼片段和文件信息

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????6704??2017-05-28?06:38??tp5_html_cache1\ReadHtmlCacheBehavior.php
?????文件????????1369??2017-05-28?06:39??tp5_html_cache1\WriteHtmlCacheBehavior.php

評論

共有 條評論