Object cache
While WordPress builds a page, it keeps the answers it got from the database in memory, so it doesn’t have to ask twice. That’s the object cache. By default, it lasts for one request only: the next page starts with an empty memory. A persistent object cache keeps those answers between requests, in a fast memory store on the server such as Redis or Memcached.
Why it matters
Section titled “Why it matters”A page cache answers most visits with a finished page, without WordPress. But some visits always need a page built for them: logged-in users, the cart and checkout of a shop, search results, the admin area, background tasks. For these, a persistent object cache saves many database queries, so WordPress gets the page together sooner.
Not every site needs one. A small site whose visitors almost always get a cached page gains little. The larger the site and the more visits WordPress has to build, the more it helps. WordPress’s own Site Health screen suggests a persistent object cache for sites where it would help (source below).
What influences it
Section titled “What influences it”Cache: WordPress uses a persistent object cache only when a drop-in file, object-cache.php
in the wp-content folder, connects it to a memory store. A plugin usually installs that file. The
most common reason for a missing object cache is that nobody set one up, or that the hosting plan
doesn’t offer a memory store.
Server: Redis and Memcached are services on the server, and PHP needs the matching extension to talk to them. APCu is a memory store inside PHP itself. Which of these are available is up to the hosting provider.
In Permo
Section titled “In Permo”The Object cache card is in System info, tab WordPress, under Caching.
- Active in green when WordPress uses a persistent object cache or the
object-cache.phpdrop-in is in place. If the drop-in names itself, the card shows that name. - Not active without a color otherwise, because many sites do fine without one. The note says whether PHP already has Redis, Memcached or APCu, which an object cache plugin could use, or No Redis, Memcached or APCu in PHP.
With an object cache, WordPress keeps temporary data there instead of in the database; the expired transients card then has nothing to count. Under Changes, System info records when the object cache changes.
Related
Section titled “Related”Sources
- WordPress: WP_Object_Cache, accessed
- New cache Site Health checks in WordPress 6.1, accessed