Skip to content

Object Cache vs. Page Cache: What Is the Difference?

What layer does Page Cache and Object Cache work on, what is the difference between public and dynamic pages, and when is Redis or full page cache needed?

Author Bipida Editorial Team Published
Share this article

Page Cache keeps HTML responses ready to run in the full execution of WordPress hit cache. Object Cache keeps data and the result of some computations, but PHP still executes the request. Neither are rivals, and being active one does not mean absolutely unnecessary of the other; choice depends on the type of traffic and dynamic pages.

Short answer:For the same public pages, Page Cache usually has a more direct effect on TTFB and PHP load. For wp-admin, logged-in users, APIs, and sections where public HTML cannot be cached, Object Cache may reduce duplicate queries.

Direct comparison of two types of cache

The featurePage CacheObject Cache
What's being stored?Full HTML responseObject, option and result data
PHP running in hitIt might get knocked out.It's going on.
An unknown user.Very well suited for public display.Depending on the query useful
User logged inOften bypassIt can be helpful.
The box and the check-out.It shouldn't be publicly cached.With proper compatibility and invalidation
The main risk.Displaying a personal response to another userData stale, collision and RAM consumption

How does Page Cache work in practice?

The cache key is usually made up of a host, path, query, and sometimes a cookie or language. In a hit, CDN, reverse proxy, or plugin, it can return the previous HTML. If the key does not have the required variation, the price, language, or personal content will be displayed incorrectly. If the variation is too high, the hit rate will drop.

The cache method in CDN, Nginx and WordPress plugins is not the same. Multiple layers of cache can hold the old version without purge recognition. Document cache headers, age and purge path.

Object Cache in a Request and Between Requests

WordPress has an internal object cache, but without a stable backend, the data is usually deleted at the end of the request. Drop-ins such as Redis connections make it persistent. The connection plugin is responsible for prefix, serialization, groups, and failure behavior; Redis does not automatically understand the logic of permission or the WooCommerce entity.

Details of installation and evaluation inRedis's guide to WordPressConnected status only determines the connection, not hit rate or speed increase.

Which is more suitable for each type of page?

  • General article:Page Cache is usually preferred.
  • wp-admin:Page Cache is not a good public cache; Object Cache might help.
  • Search and filter:It depends on the variety of query and cache policy.
  • The user account:Personal HTML; Object Cache is more likely to be compatible.
  • checkout:Session accuracy, price and availability are paramount.
  • REST API:Public read has no policy with private write.

Cache Hit, Miss and Bypass

Hit means the answer or object found, miss means it must be made, and bypass means the policy does not allow. Separate the three in the measurement. The first request after the purge is not the same as the hot request.

Invalidation is the hardest part of the cache.

After written editing, price change, ordering, or role change, the associated data must be expired. Purge the entire cache seems simple but makes a cold start and sudden push to PHP/MySQL. Targeted invalidation, matching TTL and multi-session testing are required.

In the WooCommerce,Redis appraisal for the storeIt must cover price, inventory, coupon, tax and callback payments.

Three layers of common cache

  1. Browser/CDN:asset and sometimes public HTML near the user.
  2. Page cache at origin:Full response without heavy application execution.
  3. Object Cache:Reducing query and computation in PHP requests.

OPcache is another layer that caches PHP bytecode and is not the same as Object Cache. The use of the word cache for all these layers should not lead to one knowing how to set and purge them.

How do we choose?

  1. Categorize the main pages and users.
  2. Take TTFB, PHP time and query time baseline.
  3. Determine the share of hits and dynamic traffic.
  4. Activate a layer with clear policy.
  5. Measure hit/miss, sources and accuracy of content.
  6. Test failure and rollback in staging.

If the public page is fast at hit but the wp-admin is slow, adding the Page Cache will no longer help.The slowdown WordPress guide.Follow him.

Security and isolation.

Redis should not be open without network control on the Internet. Production and staging should have separate prefixes and settings. In Page Cache, cookies and authorization should also be bypassed correctly. Test with two users and two browsers to ensure that personal data is not transferred.

What do we monitor for each layer?

In Page Cache, record hit rate, bypass reason, age, purge, and origin time. In Object Cache, hit/miss, eviction, memory, latency, and connection errors are important. Compare these metrics with TTFB, PHP queue, and MySQL load over a time period; a separate chart without a shared timeline does not explain the cause.

For example, an increase in eviction with increased query and latency is more valuable than a Redis RAM warning, because Redis is designed to use RAM. For Page Cache, a drop in hit rate after deployment should be traceable by changing the rule or purge.

The crash program and the rollback.

Know in advance who the error bypasses the layer when Redis is deleted, and how the error bypasses the layer. Removing the drop-in or restart under load can create a request wave to the origin. Rollback in the test staging and then monitor the error rate, PHP and MySQL rows.

Common Mistakes

  • Enabling multiple page caches at the same time
  • Suppose Redis is fully caching HTML.
  • Public cache checkout or user account
  • Flush is timed to hide invalidation broken
  • Sharing namespace between staging and production
  • Assessment with just one warm request.

When do you need special assistance?

If you have multiple layers of CDN, proxy and Redis, or personal and transactional pages are important, a misspelled rule can display incorrect data.WordPress speed boost serviceIt can evaluate the cache architecture based on the actual hit rate, accuracy, and workload.

Common Questions

Do we need both Cache?

Not always; for a mixed site they may be complementary, but the need must be proven by the type of traffic and measurement.

Does the object cache delete the database?

No. The database is the primary source, and the cache only reduces some of the reading and computing.

Why is the site slowing down after the purge?

The cache is cold and requests are reconstructing the data; a widespread purge can cause a stampede.

When Is Redis Useful for WooCommerce, and When Can It Cause Problems?
Examine the use of Redis in checkout, user account and WooCommerce catalog, focusing on invalidation of inventory, session, RAM and actual measurement.