Quickstart

To get Object Cache Pro up and running quickly follow the guide below. For a more in-depth guide head over to Installation.

Requirements

Object Cache Pro requires PHP 7.2 or newer as well as the PhpRedis extension.

Preparation

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.

Installation

Object Cache Pro can be installed using Composer, or uploaded as a plugin in your Dashboard. For larger deployments, you can deploy it as a Must-Use plugin.

Configuration

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 wp-config.php file.

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.

Activation

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! 🚀🎉

Deployment

If your site has an automated/scripted deployment process, follow the deployment guide to keep your object-cache.php drop-in up-to-date.