WordPress

What is the difference between page caching and object caching?

Short answer

Page caching stores a finished page so repeat requests skip most of WordPress. Object caching stores pieces of data WordPress needs while building a page. They solve different problems and can be used together.

What changes the answer

  • Anonymous visitors versus logged-in or cart traffic
  • Whether a persistent object cache backend is installed
  • How cached content is cleared when you change it

Two different layers

A page cache saves the generated HTML of a page. When the next visitor requests the same URL, the server can return the saved copy without running most of WordPress or querying the database. An object cache sits inside WordPress. It stores data WordPress fetches repeatedly while it builds a page, such as the results of lookups, so the same work is not repeated within a request or, with a persistent backend, across requests.

What WordPress provides by default

WordPress includes a cache class, WP_Object_Cache. By default its contents last only for the current request. To keep objects between requests you need a persistent object cache, usually supplied through a drop-in and a backend service that your host provides or you install. A page cache is different again: it is normally added by a plugin, the web server or a CDN.

Which one helps which request

Public posts and landing pages that look the same to every visitor suit page caching. Carts, checkouts, account pages and the admin area are personalised, so they are often excluded from page caches and still need PHP workers and database queries. An object cache can reduce repeated database work for those uncached requests, although the benefit depends on the site's code and plugins.

What to check

  • What your host or plugin caches, and which URLs and cookies make it skip the cache.
  • Whether a persistent object cache is installed and actually connected, rather than assumed.
  • That edited content becomes visible to visitors and that old copies are cleared.

Do not let caching hide a slow backend

A fast cached page can make a site look healthy while uncached requests, such as checkout, remain slow. Test uncached requests separately before deciding how much memory and how many workers you need. The WordPress memory calculator treats those dynamic requests as the budget.