Updated: 28 September 2026 · Applies to: WordPress 7.1 with Redis Object Cache
WordPress runs many database queries on each page. A persistent object cache stores their results in Redis (or Valkey), so repeated queries come from memory. This helps most on busy sites, WooCommerce stores and sites with many plugins.
Requirements
- A Redis or Valkey server on your VPS or dedicated server (see "How to install Redis 4 on Centos 6 / 7, Ubuntu 16 and Debian 8 (Updated)?").
- The PHP extension phpredis (see "How to Install phpredis on CentOS 8 / RHEL 8?").
Set it up
- In
wp-config.php, above the line/* That's all, stop editing!, add a unique prefix (important when several sites share one Redis):
define( 'WP_REDIS_HOST', '127.0.0.1' ); define( 'WP_REDIS_PORT', 6379 ); define( 'WP_CACHE_KEY_SALT', 'example.com:' );
- In WordPress, go to Plugins › Add Plugin, search for Redis Object Cache, install and activate it.
- Open Settings › Redis and click Enable Object Cache. The status should show Connected.
Check that it works
Browse a few pages, then run redis-cli info stats | grep keyspace or redis-cli --scan --pattern "example.com:*" | head on the server to see cached keys.
Good to know
- An object cache is not a page cache. For full-page caching use a caching plugin or your server's cache in addition.
- If Redis stops, the plugin falls back to the database; the site stays up but is slower.
- To clear the cache, click Flush Cache in the plugin settings.
Note: On shared cPanel hosting, check with our support team whether Redis is available for your plan before installing the plugin.