Configuration

All configuration for Redis Cache Pro happens with a single PHP constant: WP_REDIS_CONFIG. Any configuration error will generate an error log entry, and if WP_DEBUG is enabled, additionally throw an exception.

Be sure to define the WP_REDIS_CONFIG constant towards the top of your wp-config.php, not the very bottom.

To easily disable the object cache, you may use the WP_REDIS_DISABLED constant or environment variable. Read more about it in the debugging instructions.

Connecting to an instance

wp-config.php
define('WP_REDIS_CONFIG', [
'token' => '...',
'host' => '127.0.0.1',
'port' => 6379,
'password' => 'secret',
]);

Connecting to a cluster

wp-config.php
define('WP_REDIS_CONFIG', [
'token' => '...',
'password' => 'secret',
'cluster' => [
'tcp://127.0.0.1:7001',
'tcp://127.0.0.1:7002',
'tcp://127.0.0.1:7003',
'tcp://127.0.0.1:7004',
],
]);

Configuration options

Detailed descriptions for all configuration options are coming soon.

These are all available Configuration options:

wp-config.php
define('WP_REDIS_CONFIG', [
'token' => null, // (string) Your license token
'logger' => null, // (string) The logger class name
'log_levels' => null, // (array) Log levels
'host' => null, // (string) The hostname of the instance
'port' => null, // (integer) The port of the instance
'database' = 0, // (integer) The Redis database
'password' => null, // (string) The instance/cluster password
'prefix' => null, // (string) The prefix for all keys
'maxttl' => null, // (integer) The maximum time-to-live in seconds
'timeout' => 0.0, // (float) Connection timeout in seconds
'read_timeout' => 0.0, // (float) Read timeout in seconds
'retry_interval' => 0, // (integer) Retry interval in milliseconds
'persistent' => false, // (bool) Whether the connection is persistent
'cluster' => null, // (array|string) The cluster configuration name as string, or an array of cluster nodes
'slave_failover' => null, // (string) Slave failover / distribution strategy (`none`, `error`, `distribute`, `distribute_slaves`)
'serializer' = 'php', // (string) The data serializer (`php` or `igbinary` supported)
'global_groups' => null, // (array) The list of global cache groups that are not blog-specific in a network environment
'non_persistent_groups' => null, // (array) The non-persistent groups that will only be cached for the duration of a request
'debug' => false, // (bool) Whether debug mode is enabled
'save_commands' = false, // (bool) Whether all executed commands should be logged
]);

Database

The database option determines Redis database used to store all cache data. The default is 0.

wp-config.php
define('WP_REDIS_CONFIG', [
'database' => 2,
]);

Prefix

Similar to WP’s $table_prefix variable, which prefixes all database table names, the prefix option will place the given string in front of all cache keys.

wp-config.php
define('WP_REDIS_CONFIG', [
'prefix' => 'mysitename',
]);

Token

The token option should be set to the license token you received when after purchasing. It's a 60 characters long string and will enable automatic plugin updates and unlock features.

wp-config.php
define('WP_REDIS_CONFIG', [
'token' => '02269ec4add8cac59...',
]);

MaxTTL

The maxttl option will enforce a "maximum time-to-live" for all new cache keys in seconds. It's value must be an integer.

This option will only affect keys created in the future. You might want to flush your cache once to purge keys without an expiration.

wp-config.php
define('WP_REDIS_CONFIG', [
'maxttl' => 3600 * 24, // 24 hours
]);