WordPress使用Redis加速网站

一、安装redis:

二、调用Predis:

I recommend Predis. Upload predis.php to the WordPress root directory. See more about Predis on Github (if you use a newer version of Predis you need also to modify the script below).

点击下载Predis.php代码


链接: http://pan.baidu.com/s/1i4Ie2Tf 密码: a8mn

三、Installing the PHP script for the Frontend Cache:

展示index-with-redis.php代码

四、执行步骤

①:安装+运行redis;
②:下载predis.php到wordpress根目录;
③:index-with-redis.php改名为index.php;
④:链接: http://pan.baidu.com/s/1i4Ie2Tf 密码: a8mn

五、结果对比

未安装:

安装后:

六、测试说明

未开启redis的时候,每次请求网站的时候都会请求mysql,而开启redis后,第一次请求会请求到后端的mysql,以后的内容都缓存到了redis中。

参考文档:
1:https://www.jimwestergren.com/wordpress-with-redis-as-a-frontend-cache/
2:http://www.jeedo.net/lightning-fast-wordpress-with-nginx-redis/

Byrd

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: