10+
May 4, 2020
August 4, 2010
APC Object Cache provides a persistent memory-based backend for the WordPress object cache. APC must be available on your PHP install.
An object cache is a place for WordPress and WordPress extensions to store the results of complex operations. On subsequent loads,
this data can be fetched from the cache, which will be must faster than dynamically generating it on every page load.
The APC Object Cache backend is also compatible with Batcache, the powerful full page caching engine that runs on WordPress.com
Be sure to read the installation instructions, as this is not a traditional plugin, and needs to be installed in a specific location.
object-cache.php
to your WordPress content directory (wp-content/
by default).Yes! APC 3.1.1+ supports incrementers and handles its own cleanup of expired objects, so it works just fine for Batcache. Lower versions of APC will work, but the hits trigger will be disabled.
Maybe, but I’m not going to support them, and you shouldn’t still be running them!
Define WP_APC_KEY_SALT
to something that is unique for each install (like an md5 of the MySQL host, database, and table prefix).
wp_cache_switch_to_blog()
die()
when people mistakenly try to activate this as a plugin, and provide a helpful message for where they should move the filemd5( ABSPATH )
calculation once per load (props jdub)wp-config.php
setups to define WP_APC_KEY_SALT
to guarantee key uniqueness (props jdub)preg_replace()
call in ::key()
(props jdub)incr
method to incr2
and then conditionally add incr
via class extension (so that Batcache can properly detect incrementor support)