Caching and CDN Strategy That Actually Works

The layers, from edge to database

  • CDN / edge cache — static assets and, where safe, full HTML pages served near the visitor.
  • Server page cache — LiteSpeed LSCache or NGINX FastCGI cache returning stored HTML without invoking PHP.
  • Object cache — Redis or Memcached storing query and computation results between requests.
  • OPcache — compiled PHP bytecode held in memory.
  • Database query cache and well-designed indexes — the last line, and often the real bottleneck.

What must never be cached

  • Cart, checkout and account pages.
  • Any response that varies by logged-in user, unless you cache per user deliberately.
  • POST responses, API endpoints returning private data, and admin areas.
  • Pages containing one-time tokens or nonces.

Serving one customer's cart to another is the classic catastrophic caching bug. Exclude these paths explicitly and test while logged in and logged out.

Purge rules to configure

  • 1 Purge the affected page plus its listings and the homepage when content is published or edited.
  • 2 Purge product pages and category archives on price or stock changes.
  • 3 Purge all on theme or plugin updates and on CSS/JS changes.
  • 4 Version your asset filenames so a CSS change never depends on a browser cache purge.
  • 5 Use stale-while-revalidate where supported so visitors never wait for a regeneration.

CDN configuration essentials

  • Long max-age on versioned static assets; short or no caching on HTML unless you have a solid purge mechanism.
  • Enable Brotli compression and HTTP/2 or HTTP/3.
  • Respect the Vary header for content negotiation, and normalise query strings to avoid cache fragmentation.
  • Keep the origin protected so no one bypasses the edge.
  • Serve images through an optimising pipeline that handles format and size per device.

Frequently asked questions

Is Redis worth adding?

For WooCommerce, membership and any site with heavy uncacheable pages, yes — it removes repeated database work on every request.

Why do I still see old content after purging?

Something upstream is caching: the browser, a service worker, the CDN edge, or a second proxy. Test with a fresh private window and check response headers to find which layer served it.

Need a hand applying this?

Our engineers can do it for you. Open a ticket and we will help.