Wordpress Redis缓存加速
前端缓存的PHP脚本
$wget https://gist.githubusercontent.com/JimWestergren/3053250/raw/d9e279e31cbee4a1520f59108a4418ae396b2dde/index-with-redis.php
$chown www.www ./index-with-redis.php
修改index-with-redis.php
$cf = 0; // set to 1 if you are using cloudflare
$debug = 1; // set to 1 if you wish to see execution time and cache actions
$display_powered_by_redis = 0; // set to 1 if you want to display a powered by redis message with execution time, see below
替换index.php
mv index.php index.php_bk #替换到原来的index.php,也可以改nginx伪静态规则
mv index-with-redis.php index.php
缓存问题
index-with-redis.php中有注释
Appending a ?c=y to a url deletes the entire cache of the domain, only works when you are logged in
Appending a ?r=y to a url deletes the cache of that url
Submitting a comment deletes the cache of that page
Refreshing (f5) a page deletes the cache of that page
- 登录后台网站url后面加上?c=y即可刷新整个网站
- 可以在网站页面后面加上?r=y即可手工刷新
- 提交评论会自动刷新页面
- 刷新(f5)页面也可以刷新页面