Skip to content

WordPress Site Health: "You should use a persistent object cache"

What the WordPress persistent object cache notice actually checks, when ignoring it is the correct answer, and how to satisfy it properly with Redis without breaking the site.

This one sits under Recommended improvements, not Critical issues, and that placement is the whole story: nothing is broken, and the site will keep serving traffic exactly as it does today if you never touch it. Site Health is not measuring your site — it is checking a single boolean and printing generic advice. The rule for whether to act is simple: a persistent object cache only helps requests that actually execute PHP. If a real share of your traffic runs PHP — logged-in users, a WooCommerce cart, wp-admin sessions, REST calls — installing one is worth an afternoon. If your site is a brochure whose every visitor is served pre-rendered HTML by a page cache, you can dismiss the notice and lose nothing, because the object cache would sit there answering almost no queries.

What you’ll accomplish

  • Read the notice for what it is: a check on whether an object-cache.php drop-in exists, not a performance measurement
  • Decide, with evidence from your own traffic, whether a persistent object cache would do anything for you
  • Install exactly one drop-in correctly if the answer is yes, with the keyspace isolated per site
  • Verify the cache is genuinely serving hits rather than just being installed
  • Remove it cleanly if you change your mind, without leaving a stale drop-in behind

Prerequisites

  • WordPress 5.8 or newer (the notice has shipped in Site Health since 6.1) with administrator access
  • Shell access with WP-CLI 2.x if you want to follow the command-line path; every step here has a plugin-screen equivalent
  • For the install path: a Redis or Memcached instance you control or that your host explicitly offers, plus the matching PHP extension (phpredis for Redis, memcached for Memcached)
  • A backup or staging copy. Object-cache drop-ins are a single file, but a wrong one takes the site down hard

How it works

WordPress has always had an object cache. wp_cache_get() and wp_cache_set() exist on every install, and core uses them constantly — every get_option(), get_post_meta(), and term lookup goes through the cache API before it reaches the database. Without a drop-in, the backing store for that API is a plain PHP array held in the process memory of the request that created it. It deduplicates work within a single page load, which is real but modest, and then PHP tears the process down and the entire array evaporates. The next request rebuilds it from scratch.

A persistent object cache replaces that array with a network- or socket-attached store — Redis or Memcached — so the values outlive the request. The second request for the same page finds the option payload, the user meta, the term relationships already computed, and skips the corresponding database round trips entirely. Under the hood this is one file: wp-content/object-cache.php, a drop-in that WordPress loads very early and that redefines the whole WP_Object_Cache class. The WP_Object_Cache reference on developer.wordpress.org documents the interface a drop-in has to implement.

The Site Health test does exactly one thing: it calls wp_using_ext_object_cache(), which returns true when a drop-in has registered itself as external. No drop-in, no true, notice shown. It does not know how much traffic you get, whether you already run a page cache, or whether your database is under any pressure at all.

That last point is why the same notice deserves opposite responses on two different sites, and the difference is visible in the request path:

Two WordPress request paths side by side: an anonymous request served from the page cache never reaching PHP or the object cache, and a logged-in cart request bypassing the page cache, running PHP, and consulting the object cache before MySQL

An anonymous visitor on a page-cached site never gets past the first box. PHP does not start, so the object cache is never consulted, so making it persistent changes nothing for that visitor. A logged-in or cart request carries a cookie that forces a page-cache bypass by design — you cannot serve one shopper another shopper’s cart — so it runs the full PHP path every time, and that is where a persistent cache pays. This distinction is the one most write-ups skip; if you want the layered version, see object cache vs page cache.

Step-by-step

1. Confirm what the notice is reporting. Ask WordPress directly rather than trusting the admin screen:

wp cache type

Expected output on a site with no drop-in:

Default

On a site with the Redis drop-in installed and connected, the same command prints Redis. Cross-check the file itself:

wp plugin list --status=dropin

A site with no object cache lists nothing (or only advanced-cache.php if a page-cache plugin is present). If object-cache.php is listed but wp cache type still says Default, you have a drop-in that failed to connect — jump to Troubleshooting.

2. Measure how much of your traffic reaches PHP. This is the decision input, and it takes one request:

curl -sI https://example.com/ | grep -iE 'x-cache|cf-cache-status|x-litespeed-cache|age:'

A response like cf-cache-status: HIT or x-cache: HIT on your public pages means anonymous traffic is being served without PHP. Now weigh that against what does run PHP: WooCommerce cart and checkout, /wp-admin/, /wp-json/ endpoints, logged-in members, and WP-Cron. If those are a rounding error in your logs, the notice is describing a problem you do not have.

3. Check the pressure on the PHP path. A large autoloaded options table is the single most common reason a persistent cache produces a visible improvement, because every PHP request pays for it:

wp option list --autoload=on --format=count

A few hundred is normal. Several thousand autoloaded options means every request is unserialising a large blob before it does anything useful. Note that a persistent cache hides this cost rather than fixing it — the honest order of operations is to trim it first, which the wp_options autoload audit walks through.

4. Make the call. With those three answers in hand the decision is mechanical:

Decision tree for the WordPress persistent object cache notice, keyed on whether traffic reaches PHP, whether Redis or Memcached is available, and whether another drop-in is already installed

5. Confirm a backend actually exists. Do not install the plugin first. On a VPS you control:

redis-cli -h 127.0.0.1 -p 6379 ping

Expected output:

PONG

On cPanel or shared hosting, Redis may be available per-account over a Unix socket, available server-wide, or not available at all — and the third case is common. Ask your host for the socket path or the host/port and confirm the PHP extension is loaded for your PHP version:

php -m | grep -iE '^redis$|^memcached$'

If that prints nothing, the extension is missing and no plugin will help until it is enabled.

6. Install exactly one drop-in. For Redis on a site you control, the Redis Object Cache plugin is the common choice:

wp plugin install redis-cache --activate
wp redis enable

Expected output:

Success: Object cache enabled.

wp redis enable is what copies the drop-in into place; activating the plugin alone does not. The equivalent in the admin is Settings → Redis and the Enable Object Cache button.

7. Isolate the keyspace before you take traffic. This is the step that turns a shared Redis into a liability. If two WordPress sites write to the same Redis database with the same key prefix, they overwrite each other’s options and user data — a genuine cross-site data leak, not just a cache-efficiency problem. Give each site its own database number, its own prefix, or both:

wp config set WP_REDIS_DATABASE 3 --type=constant --raw
wp config set WP_REDIS_PREFIX 'shopsite_' --type=constant
wp redis update-dropin

Confirm the constants landed:

wp config get WP_REDIS_DATABASE

Expected output:

3

For the cPanel-specific variant of this — where the socket path and per-account limits differ — see the cPanel Redis object cache setup. If you are still choosing a backend, the Redis vs Memcached comparison covers the tradeoffs.

8. Set an eviction policy that fits a cache. A Redis instance dedicated to object caching should evict rather than refuse writes:

redis-cli CONFIG GET maxmemory-policy

Expected output on a correctly configured cache instance:

1) "maxmemory-policy"
2) "allkeys-lru"

If it returns noeviction, Redis will start rejecting writes once maxmemory is reached and WordPress will throw errors instead of quietly dropping cold keys. The policy tradeoffs are documented in the Redis documentation.

Validate it works

Three things must all be true, and installing the plugin only guarantees the first.

The drop-in is present and WordPress recognises it:

wp cache type
wp plugin list --status=dropin --fields=name,status

Expected output:

Redis
+------------------+---------+
| name             | status  |
+------------------+---------+
| object-cache.php | dropin  |
+------------------+---------+

The cache is actually being used. Browse a few admin pages and hit the front end while logged in, then read the counters:

redis-cli -n 3 INFO stats | grep -E 'keyspace_hits|keyspace_misses|evicted_keys'
redis-cli -n 3 DBSIZE

DBSIZE climbing above zero proves the drop-in is writing to the database you configured. Hit rate is keyspace_hits / (keyspace_hits + keyspace_misses) — check it after a few hours of real traffic, not immediately after a flush, when it will look terrible for obvious reasons. A warm object cache on a busy site normally settles well above 90 percent. evicted_keys should stay near zero; a number that climbs steadily means the instance is too small for the working set and keys are being thrown out before they get reused.

Finally, reload Tools → Site Health and confirm the notice has moved out of the recommended list. If it has not, the drop-in is present but not connecting.

Troubleshooting

The notice persists after installing the plugin. Almost always the drop-in was never copied into place. Activating redis-cache does not install the object cache; wp redis enable does. Verify with ls -l wp-content/object-cache.php. The other cause is a read-only wp-content directory, which makes the copy fail silently in the admin.

wp cache type says Default but object-cache.php exists. The drop-in loaded and could not reach its backend, so it fell back to the in-memory array. Check the connection from PHP’s point of view:

wp redis status

A failed connection reports the reason — wrong socket path, wrong port, NOAUTH Authentication required when WP_REDIS_PASSWORD is missing, or a firewall between the web server and the Redis host. Fix the constant and run wp redis update-dropin.

The site broke after removing the plugin. Deleting an object-cache plugin does not always delete its drop-in, and a object-cache.php that references classes from a plugin no longer on disk produces a fatal error on every request. The clean removal is always two steps:

wp redis disable
wp plugin deactivate redis-cache

Then confirm the file is gone with ls wp-content/object-cache.php, and delete it manually if it is not. The same hazard applies to any leftover drop-in from a previous host or a bundled hosting plugin — two object-cache drop-ins cannot coexist, because there is only one filename, so a second installer silently overwrites the first and the loser’s plugin keeps reporting success.

Keys are evicted almost as fast as they are written. evicted_keys climbing and hit rate stuck low means maxmemory is too small for the working set, or several sites are sharing one database and evicting each other. Check redis-cli INFO memory | grep -E 'used_memory_human|maxmemory_human', then either raise the ceiling or split the sites across database numbers with distinct prefixes.

wp-admin got slower, not faster. This happens when the Redis instance is a network hop away with real latency, or when TLS is terminating on every connection without persistent connections. An object cache turns one local database query into one remote cache lookup; if that lookup costs more than the query it replaced, you have moved the problem. Measure with redis-cli --latency and prefer a Unix socket over TCP when Redis is on the same machine.

When this is the wrong approach

Ignoring the notice is the correct answer more often than the WordPress admin implies. A brochure site, a small blog, or a marketing site where every anonymous visitor is served by a page cache gets close to nothing from a persistent object cache, because the requests that would consult it barely exist. Adding Redis to that site buys you a second daemon to monitor, a second thing that can fail at 3 a.m., and a new class of stale-data bug — in exchange for speeding up the handful of requests a month where you personally log into wp-admin. Dismissing the notice and revisiting it when you add WooCommerce or memberships is a defensible engineering decision, not laziness.

It is also the wrong first move when the real problem is upstream. A site with ten thousand autoloaded options, an unindexed postmeta table, or a plugin issuing uncached queries in a loop will see the object cache paper over the symptom while the underlying cost stays. And on shared hosting where Redis is offered but shared across accounts with no isolation, the safe answer may genuinely be to skip it: a cache you cannot isolate is a cache you cannot trust.

Running WordPress that earns real money deserves an operator — Stack Harbor runs that stack under Enterprise WordPress; book an infrastructure consult.