WordPress Redis object cache: what it is and how to enable it
· The AYT team · 6 min read

Redis is a cache server that keeps data in memory. In WordPress you use it as a persistent object cache: the results of database queries stay in Redis between visits, so WordPress doesn't ask MySQL for them again on every page. It helps most in wp-admin, on WooCommerce stores and on pages for logged-in users. To enable it you need a Redis server at your host, a few constants in wp-config.php and the Redis Object Cache plugin.
What the object cache does
WordPress has a built-in object cache, but it only lives for the length of one request. On the next page, WordPress starts from scratch and repeats the same queries: site settings, menus, user data, products. With Redis, the results stay in memory and the next page takes them from there, much faster than from the database.
Object cache or page cache
The two are often confused, but they solve different problems:
| Page cache | Object cache (Redis) | |
|---|---|---|
| What it stores | the finished HTML page | the results of database queries |
| Who benefits | visitors who aren't logged in | everyone, wp-admin included |
| Does PHP run? | no, the page comes straight from the cache | yes, but with fewer queries |
| Cart, checkout, customer account | never cached | get faster |
A business site read by anonymous visitors gains most from the page cache. A store, a membership site or a site with a lot of work in wp-admin gains from Redis. The two work well together.
When Redis helps and when it doesn't
Redis helps when:
- wp-admin loads slowly, especially the product and order lists;
- you run a WooCommerce store with many products and variations;
- many users are logged in at the same time (courses, membership, forum);
- Site Health recommends a persistent object cache.
It doesn't help when the site is slow because of large images or JavaScript (a front-end problem, see Core Web Vitals in WordPress), or when a single plugin does heavy work that has nothing to do with the database.
What you need
- A Redis server. On shared hosting, the provider turns it on, if it offers it. You need its address: a host and a port (usually
127.0.0.1and6379) or the path of a Unix socket. - The
redisPHP extension (phpredis), usually installed by the host. - The Redis Object Cache plugin by Till Krüss, with more than 500,000 active installs.
How to enable Redis Object Cache
- Get the Redis connection details from your host.
- Open
wp-config.phpand add the constants above the/* That's all, stop editing! */line. For a server on a host and port:
define( 'WP_REDIS_HOST', '127.0.0.1' );
define( 'WP_REDIS_PORT', 6379 );
define( 'WP_REDIS_PREFIX', 'example.com' );
For a Unix socket:
define( 'WP_REDIS_SCHEME', 'unix' );
define( 'WP_REDIS_PATH', '/path/to/redis.sock' );
define( 'WP_REDIS_PREFIX', 'example.com' );
- Install and activate the Redis Object Cache plugin.
- Open Settings → Redis and click "Enable Object Cache". The plugin copies the
object-cache.phpfile intowp-content; that's how WordPress uses Redis. - Check the status: the same page should say Redis is "Connected".
WP_REDIS_PREFIX matters when several sites use the same Redis. Without different prefixes, sites can read each other's data from the cache. Use the site's domain as the prefix and you can't go wrong.
Common problems
Changes don't show up on the site
If you changed something directly in the database (from phpMyAdmin or with a script), Redis may still hold the old value. Clear the cache from Settings → Redis with "Flush Cache". Changes made from wp-admin don't have this problem, because WordPress updates the cache itself.
Redis won't connect
The plugin shows "Not connected". Check the host, the port or the socket path, and whether the Redis service is running. If Redis goes down after you enabled the cache, by default the site shows an error. With define( 'WP_REDIS_GRACEFUL', true ); in wp-config.php, the plugin falls back to the database instead, and the site works, just without the cache.
Redis memory fills up
Redis has a memory limit. When it reaches it, it evicts old keys (or refuses new writes, depending on its configuration). For a typical site, a few tens of MB is usually enough. For large stores, keep an eye on the memory used on the plugin's page.
You want to switch it off
Click "Disable Object Cache" under Settings → Redis before you deactivate the plugin. If wp-admin no longer works, delete the wp-content/object-cache.php file from the File Manager; WordPress goes back to running without Redis at once.
Frequently asked questions
Redis or Memcached?
Both do object caching. Redis is more common on WordPress hosting, and the Redis Object Cache plugin is actively maintained. If your host offers Redis, use it.
Does Redis replace a caching plugin?
No. Redis doesn't store whole pages. You still need a page cache, from your host or from a plugin.
Does it work with WooCommerce?
Yes, and stores are among the sites that gain the most. The cart and checkout can't be served from a page cache, but they get faster with Redis because they run fewer queries.
Redis on AYT hosting
On AYT's paid plans, every account has its own Redis, which you switch on from the panel's Redis page. It runs as your account's user and only you can connect to it. Switching it on only starts the Redis server. Each WordPress site uses it once you turn on its "Object cache" in the WordPress Toolkit, on the site's Performance tab (or for several sites at once, ticked in the WordPress Toolkit list). The panel then installs and activates the Redis Object Cache plugin and writes the constants into wp-config.php itself, with the site's domain as the prefix.

The same Performance tab has the page cache and OPcache. If the site is still slow after that, that tab also shows you the slow plugins; see also why a WordPress site is slow. The plans are on the WordPress hosting page.
