Object Cache Pro

Shared Instances

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

If several sites must share the same database or when using a Redis cluster, 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,
]);

Using Prefixes

When only a single database is available to you, the 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 32 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'

Database sizes

By default, Object Cache Pro displays the Redis database size in various places. For technical reasons, this "Redis Memory" number includes all 0-15 Redis databases, not just the one set using the database configuration option.

This can be misleading for end-users, especially after clearing the cache and seeing the "Redis Memory" not drop to (near) zero.

To avoid this confusion use the shared configuration options to display object/key counts, instead of the database size.