Four Caching Layers and What Each One Actually Solves
Page cache, object cache, fragment cache and CDN edge cache solve different problems. Why checkout is never fixed by caching, and which layer most stores are missing.
Caching advice for WooCommerce is usually a list of plugins. That is the wrong level. There are four distinct caches, they solve different problems, and installing the wrong one is why stores end up with three caching plugins and a cart page that shows another customer’s items.
Layer 1: page cache
What it solves: the cost of generating HTML for anonymous visitors.
What it cannot touch: cart, checkout, my-account, and anything personalised.
A page cache stores the finished HTML of a category page and serves it without running WordPress at all. This is where the largest single win lives — a cached category page can go from 900ms to 30ms.
The configuration detail that matters most is the exclusion list. At minimum: cart, checkout, my-account, login, and any URL with a session cookie. When someone reports “I see someone else’s cart”, the cause is always a page cache serving a personalised page.
The second detail is invalidation. A stock change, a price edit or a new product should clear the affected pages. Caches that clear everything on every change are safe but thrash on busy stores; caches that clear too little serve stale prices, which is worse.
Layer 2: object cache
What it solves: repeated database queries within and across requests.
What it cannot touch: the cost of rendering templates, or network latency.
WordPress caches query results in memory during a request. An object cache backed by Redis or Memcached keeps those results between requests. On a WooCommerce store with a large catalogue, this is often the difference between 60 and 200 queries per page.
Where it pays most:
- Large catalogues with many variations
- Stores where the same products appear on multiple pages
- Admin performance — the product list and order screens benefit substantially
Where it does not help: a store with 40 products and a page cache already in front. The queries are already avoided for anonymous visitors.
The trap: object caching can make plugin bugs persist. If a plugin caches something it should not and stores it in Redis, the stale value survives deactivation and reactivation. Always flush the object cache when debugging anything strange.
Layer 3: fragment cache
What it solves: the parts of a page that cannot be cached as a whole.
What it cannot touch: genuinely per-user data such as the cart contents.
On a store where the header shows a cart count, the entire page becomes personalised and unpagecacheable. Fragment caching solves this by caching the page and rendering only the small dynamic block separately.
This is the layer most stores skip, and it is the one that unlocks page caching for sites with cart widgets. The trade-off is complexity: fragments need their own invalidation rules, and a broken fragment shows a stale count.
A simpler alternative many stores should consider: stop showing the cart count in the header. Removing one dynamic element can make the entire page cacheable, which is a larger win than any micro-optimisation of the fragment itself.
Layer 4: CDN edge cache
What it solves: distance and origin load.
What it cannot touch: uncacheable pages, and anything it is configured to bypass.
A CDN caching HTML at the edge means a customer in Australia gets a page generated once, from a server in Europe, delivered from Sydney. It also absorbs traffic spikes that would otherwise reach the origin.
Two configuration mistakes dominate:
- Caching cookies. If the CDN varies on all cookies, hit rate collapses to near zero and you pay for a CDN that behaves like a proxy
- Not purging on content change. Price and stock updates invisible to customers for the TTL period — on a store with frequent price changes, this is a commercial problem, not a technical one
What caching does not fix
This is the part that saves the most money.
Checkout. It is uncacheable by definition. If checkout takes eight seconds, caching will never help, and checkout is usually the most valuable page on the site. It needs query work, not caching.
Slow server, cached pages. A page cache will mask a slow origin until the cache misses, and then everyone waits. Cache misses are also when crawlers arrive, which means search engines see the slow version.
Large images. A CDN delivers them faster; it does not make them smaller. The image decisions are separate — see the image pipeline notes.
Bad queries on personalised pages. Logged-in customers on a B2B store bypass the page cache entirely. Their experience is the uncached one, and for B2B that is every customer.
A sane configuration
- Page cache with correct exclusions, purging on content change
- Object cache if the catalogue is large or the store is B2B-heavy
- Fragment cache only if a cart widget makes full-page caching impossible
- CDN if customers are geographically spread
- Checkout left alone, and optimised with queries instead
Nothing here is exotic, but the order matters: adding a CDN to a store with no page cache solves the wrong problem, and adding an object cache to a store with 40 products solves a problem it does not have. If you are unsure which layer is missing, the measurement sequence in the diagnosis guide will tell you before you install anything.
We handle this layer planning as part of speed optimisation, usually starting with a header check on one category page.