Wordpress删除Redis页面缓存的方法

1、删除某一个页面的缓存:发表评论、按下F5刷新、在URL后面加上?r=y回车。 
2、删除整站页面缓存:登录到Wordpress后台,在任意URL后面加上?r=y回车。 
3、更新文章时自动刷新首页缓存:在你的Wordpress的Function.php中加入以下代码(出自:https://www.shenbogame.com/4738.html): 
function newPostRefresh() { $temp=file_get_contents(“http://xxxxxxx/?r=y”); //xxxxxx自己替换 } add_action(‘publish_post’, ‘newPostRefresh’); add_action(‘edit_post’, ‘newPostRefresh’); add_action(‘delete_post’, ‘newPostRefresh’); add_action(‘comment_post’, ‘newPostRefresh’); add_action(‘edit_comment’, ‘newPostRefresh’); add_action(‘delete_comment’, ‘newPostRefresh’); add_action(‘wp_set_comment_status’, ‘newPostRefresh’); add_action(‘switch_theme’, ‘newPostRefresh’); 
4、自动更新Wordpress缓存:在crontab中配置每10分钟用curl访问首页更新缓存,每天凌晨对首页或者分类页面进行更新。 
*/10 * * * * curl http://www.freehao123.com/?r=y  1 1 * * * curl http://www.freehao123.com/fenye/?r=y 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值