WordPress使用Memcached的比较好的方案是用Batcache插件来实现,然而那些网上Memcached与WP Super Cache共用的教材早已经过时,至少目前WP Super Cache早就不支持Memcached的了,你可能一直才在错用。
官方不推荐
Q:
Hello!
wp-super-cache is the best cache plugin.
Do U plan to add memcached support to store cached pages in memcached?
I think it's nice feature to speed up website additionally.
A:
The plugin used to have very rudimentary support for using wp-cache-get/set, or memcached to store cached content but it was very very rough and never worked on. It was removed recently and nobody noticed.
Batcache is a much better choice if you want to use a memcached full page cache.
这是来自WP Super Cache官方的回答:https://github.com/Automattic/wp-super-cache/issues/706,还有一篇:https://wordpress.org/support/topic/wp-super-cache-and-memory-caching/
按照官方的说法:WP Super Cache以前支持,但是由于一直没有正常工作过,于是很早就删除了这个功能。所以推荐Batcache来做object cache。
是不是WP Super Cache与Memcached就真的不能一起用了?
其实并不是,是可以与Memcached、Redis Object Cache这类Object Cache插件一起用的。
那么怎么使用呢?
WP Super Cache是有简单模式与专家模式两种,简单模式可以开启“启用动态缓存”,这个功能其实就是WP Super Cache以前默认支持Memcached,现在这个功能最好别用,如果要使用,请用“专家模式”。
WP Super Cache 专家模式 + Memcached 或者 WP Super Cache 简单模式 + Memcached(“启用动态缓存”这一项不要勾选),这样可以正常使用。
居然不解释 天……
用Memcached,就不要用WP Super Cache,Memcached的效果很好,看我的网站就知道了