What the WordPress Object Cache Does
WordPress uses an internal object cache to avoid repeating expensive operations — primarily database queries — within a single page request. When a plugin or theme asks for the same option, post, or user data more than once during a request, the object cache serves the stored result instead of querying the database again.
object-cache.php file is present in wp-content and flags when one is missing.By default, this cache only lives for the duration of a single request. When the request finishes, everything in the cache is discarded. The next request starts with an empty cache and must rebuild it from scratch — running the same database queries all over again.
Persistent vs Non-Persistent
A persistent object cache uses an external in-memory data store — typically Redis or Memcached — to keep cached data alive between requests. Instead of discarding the cache after each page load, the data persists in memory and can be reused across all subsequent requests until it expires or is invalidated.
The difference is significant. A WordPress site without a persistent object cache might run 50–200 database queries per page load, many of them identical across requests. With a persistent object cache, those repeated queries are served from memory in microseconds instead of milliseconds.
What Gets Cached
The WordPress object cache stores:
- Options — site settings loaded via
get_option(), including all autoloaded options - Post and page data — content, metadata, and taxonomy relationships
- User data — profile information and capabilities
- Transients — temporary data that plugins store with expiration times (with a persistent cache, transients are stored in memory instead of the database)
When a Persistent Object Cache Matters Most
Not every site needs a persistent object cache. The impact depends on how database-heavy your site is:
- WooCommerce sites — product catalogs, cart sessions, and inventory checks generate heavy database traffic that benefits strongly from caching
- Membership or community sites — user-specific content and session data create high query volumes
- High-traffic sites — even simple blogs benefit when traffic is high enough that the database becomes a bottleneck
- Sites with many plugins — each plugin may add its own database queries, and the cumulative load adds up
On a low-traffic brochure site with a handful of plugins, the built-in non-persistent cache is usually sufficient.
How to Check Your Setup
WordPress uses a persistent object cache when it finds an object-cache.php drop-in file in the wp-content directory. This file is provided by caching plugins like WP Redis, Redis Object Cache, or W3 Total Cache. If the file is not present, WordPress falls back to its default non-persistent behavior.
Your hosting provider may also configure this at the server level. Many managed WordPress hosts include Redis or Memcached and install the drop-in automatically.
Further Reading
- WP_Object_Cache class reference (developer.wordpress.org) — Technical reference for WordPress’s object caching API.
- WordPress Performance Optimization (developer.wordpress.org) — Server-level performance recommendations including object caching.
