Caching

Object Caching (Redis and Memcached)

Intermediate
High

What Object Caching Does

Object caching stores the results of expensive database queries in memory so WordPress does not have to re-execute them on every page load. WordPress makes dozens to hundreds of database queries per request — loading options, user data, post meta, transients. Without a persistent object cache, these queries run from scratch every time, even though most results rarely change. Adding a persistent object cache like Redis or Memcached can reduce database queries by 80-90% and noticeably improve TTFB.

Mochyon Lightspeed detects this automatically. It measures your object cache hit ratio and flags when it is too low, indicating that caching is misconfigured or absent.

How WordPress object caching works

WordPress has a built-in object cache API (wp_cache_get(), wp_cache_set()) that plugins and core use to store and retrieve data. By default, this cache only lives in memory for a single request — it is cleared as soon as the page finishes loading. This “non-persistent” default means the same data is fetched from the database again on the next request.

A persistent object cache replaces this default with a backend that survives between requests. Redis and Memcached are the two most common backends. They store cached objects in RAM and serve them to any subsequent request, far faster than a database query.

Redis vs Memcached

Redis is the more popular choice for WordPress. It supports data structures beyond simple key-value pairs, offers optional persistence to disk, and is actively maintained with frequent updates. Most managed WordPress hosts that offer object caching use Redis.

Memcached is simpler and slightly faster for basic key-value lookups. It has been around longer and is battle-tested, but lacks Redis’s advanced features. For WordPress specifically, Redis is the better default choice unless your host only offers Memcached.

When object caching matters most

Object caching has the biggest impact on sites with heavy database usage: WooCommerce stores, membership sites, BuddyPress communities, and sites with complex queries. For a simple brochure site with page caching enabled, object caching adds modest improvement since page caching already bypasses PHP and the database. But on dynamic sites where page caching is less effective, object caching becomes essential.

Signs your object cache is not working

High database query counts (visible in tools like Query Monitor), slow TTFB on uncached or dynamic pages, and a low cache hit ratio all suggest the object cache is either absent, misconfigured, or too small for the workload.

Tools That Can Help

Redis Object Cache (free plugin by Till Kruss) connects WordPress to a Redis server with minimal configuration. Object Cache Pro is its premium version with better diagnostics and multisite support. Query Monitor shows database query counts and cache hit statistics per page load, making it easy to see whether object caching is working.

Further Reading

Related Articles

Cache hit ratio is the primary metric for knowing whether your object cache is actually working.
Page caching and object caching work at different layers — understanding both clarifies when each matters.

Need help with this?

Mochyon specializes in WordPress Core Web Vitals optimization. We diagnose, fix, and verify — with a named human accountable for the result.

Get help from Mochyon