To get Object Cache Pro up and running quickly follow the guide below. For a more in-depth guide head over to Installation.
Object Cache Pro requires PHP 7.2 or newer as well as the PhpRedis extension.
Before getting started, be sure to uninstall all existing object cache plugins, such as Redis Object Cache and WP Redis.
Additionally, if a
/wp-content/object-cache.php drop-in exists, delete it.
You can activate the plugin right away, however before the object cache can be enabled, Object Cache Pro must be configured. This is done using the
WP_REDIS_CONFIG constant in you
This configuration is a great starting point:
define('WP_REDIS_CONFIG', [ 'token' => '<your-license-token>', 'host' => '127.0.0.1', 'port' => 6379, 'database' => 0, // change for each site 'maxttl' => 86400 * 7, 'timeout' => 1.0, 'read_timeout' => 1.0, 'split_alloptions' => true, 'debug' => false, ]); define('WP_REDIS_DISABLED', false);
For advanced features such as compression and asynchronous flushing, check out the complete list of configuration options.
To connect to Redis clusters or use replication, see the connection guide.
Before activating the object cache drop-in, it’s highly recommended to flush your Redis database to avoid stale cache data. Executing
redis-cli flushall does that for you.
The object cache can be enabled in the dashboard widget by clicking “Enable Object Cache”, or by executing the
wp redis enable CLI command.
To avoid stale cache date, it’s a good practice to flush your object cache (every time) after enabling it.
You’ll now see “Status: Connected” in the dashboard widget. If not, head to Tools > Site Health for more information.
That’s it! 🚀🎉
If your site has an automated/scripted deployment process, follow the deployment guide to keep your
object-cache.php drop-in up-to-date.