Object Cache Pro

Shared Instances

When running more than one WordPress installation on the same Redis instance or cluster, it’s highly recommended to use a separate Redis database for each site.

If several sites must share the same database, a unique prefix can be configured for each site.

Using Databases #

For the best performance, it’s recommended to use a different database index 0-15 for each WordPress installation, by using the database configuration option.

By default, Redis has 16 databases. This can be increased to in your redis.conf.

define('WP_REDIS_CONFIG', [
'host' => '127.0.0.1',
'database' => 0,
]);

Keep in mind that Redis clusters only have a single database.

Using Prefixes #

When only a single database is available to you, best way to isolate individual sites is using the prefix configuration option.

The downside of using a prefix over different databases is that cache flushes are global. If site A flushes the object cache, then site B and C will also be flushed.

define('WP_REDIS_CONFIG', [
'prefix' => 'mysitename',
]);

Prefixes must be 14 characters or less. To optimize human readability avoid special characters and use simple string such as:

// Good
'apple'
'bugs-apple'
'apple-jobs'

// Bad
'www_apple_com'
'jobs.apple.com'
'1f3870be274f6c49b3e31a0c6728957f'