- Article
- Intermediate
- 2 minutes read
- Reviewed August 4, 2026
- WordPress performance
The WordPress object cache stores values that would otherwise need to be recalculated or retrieved from the database during a request.
By default, the core object cache is non-persistent. Its values normally disappear when the current PHP request ends.
What the Object Cache Stores
WordPress can cache:
- Options.
- posts and post metadata.
- terms.
- users.
- query results.
- custom plugin data.
- computed values.
Developers access it through the wp_cache_* functions rather than using the cache class directly.
Persistent Object Caching
A persistent object-cache implementation stores values between requests, commonly through Redis or Memcached.
WordPress loads an object-cache.php drop-in when the implementation is installed correctly.
Persistence can reduce repeated database work on dynamic, logged-in and high-query workloads.
Object Cache vs Page Cache
A page cache stores complete HTML responses.
An object cache stores data used while WordPress still generates a dynamic response.
A site can use both. Dynamic pages that cannot use full-page caching may benefit particularly from persistent object caching.
Transients
The Transients API stores values with an expiration.
When persistent object caching is available, transients can be stored there. Without it, they are commonly stored in the database.
Expiration is a maximum lifetime, not a promise that the value will remain available until that moment.
Cache Invalidation
Cached data must be deleted or replaced when its source changes.
Incorrect invalidation can produce stale prices, permissions, counts or content. Excessive flushing can remove useful cache for every site or user.
Use specific keys and groups where possible.
Measuring Benefit
Review:
- Database query time.
- Cache hit rate.
- Memory use.
- eviction.
- network latency to the cache service.
- serialization cost.
- uncached fallback behavior.
A remote or undersized cache can add overhead instead of reducing it.
Frequently Asked Questions
Does every site need persistent object caching?
No. It is most useful when repeated database and computed-object work is material.
Does object caching make HTML static?
No. WordPress still generates the response unless a page cache handles it.
Continue Learning
Previous: Browser Caching and Compression