WordPress开启Batcache后好处太多了,缓存从内存访问实在是快啊,也不担心Nginx WP Super Cache URL重写的麻烦,也不会出现Memcached与WP Super Cache共用错误的问题。Batcache默认的缓存时间是300s,也可以进行调整。
advanced-cache.php
文件中大致43行:
var $max_age = 300; // Expire batcache items aged this many seconds (zero to disable batcache)
修改为
var $max_age = 3600; // Expire batcache items aged this many seconds (zero to disable batcache)
设置之后就可以看到了页面源码:
<!-- generated in 0.239 seconds 25783 bytes batcached for 3600 seconds -->
除此之外,还可以通过wp-config.php
中设置:
// Custom Batcache settings for the end of wp-config.php global $batcache; if ( is_object($batcache) ) { $batcache->max_age = 3600; // Seconds the cached render of a page will be stored $batcache->seconds = 3600; // The amount of time at least 2 people are required to visit your page for a cached render to be stored. } // End custom Batcache settings