Edge caching strategies


A slow origin is expensive: it raises bounce rate, forces you to overprovision servers, and makes performance unpredictable during promotions. Edge caching is one of the few changes that can reduce latency and reduce infrastructure stress at the same time.

Edge caching strategies are the rules and patterns you use to store and serve responses from CDN "edge" locations (close to users) instead of repeatedly generating them at your origin. The strategy is not just "turn cache on" – it's deciding what to cache, how long, how to vary, and how to keep it fresh without breaking personalization or correctness.

Stacked bars comparing TTFB components for origin served vs edge cached requestsTTFB often drops dramatically when responses are served from the edge, because both origin distance and origin processing time shrink.

What edge caching reveals

Edge caching isn't a single metric, but it directly changes the metrics that drive business outcomes:

Most teams feel this as: fewer "the site is slow today" complaints, fewer emergency scaling events, and better paid traffic efficiency (because landing pages don't waste clicks).

The Website Owner's perspective
If edge caching reduces TTFB by even a few hundred milliseconds on high-traffic landing pages, you're not just improving a score – you're buying more reliable conversion during campaigns and reducing the operational risk of peak days.

Which pages should be cached

A practical edge caching strategy starts by classifying your site into "safe to cache" and "must be dynamic," then handling gray areas with patterns like short TTLs, careful cache keys, and selective bypass.

Strong candidates

These should usually be cached aggressively:

Usually avoid caching (or cache carefully)

These commonly require bypass or strict variation:

  • Cart, checkout, account pages (personal data risk)
  • Personalized pages (pricing by segment, logged-in recommendations)
  • Anything behind Authorization headers unless you fully understand per-user caching behavior

A usable policy matrix

Page typeTypical edge TTLVary by cookie?Notes
Images/CSS/JS/fontsLong (days to 1 year)NoUse fingerprinted filenames so you can cache "forever."
Blog/marketing pagesMedium (minutes to hours)RarelyPurge on publish; otherwise rely on TTL.
Category/listingShort (30s to 5m)SometimesGreat ROI; inventory changes can be handled with short TTL or purge.
Product detailShort to medium (1m to 30m)SometimesVary only on what truly changes the HTML (geo, currency).
Cart/checkout/accountNo cacheYes (bypass)Treat as private; avoid accidental sharing.

For more on choosing TTLs, see /academy/effective-cache-ttl/.

How edge caching decisions are made

At a high level, every CDN edge cache makes the same decision:

  1. Create a cache key (what makes this request "the same" as another request)
  2. Look up that key in cache
  3. If found and fresh, return a hit
  4. If missing or stale, fetch from origin (a miss), then maybe store it

Your strategy controls steps 1 and 4.

Cache keys: the #1 source of surprises

A cache key commonly includes:

  • URL path (/products/widget)
  • Query string (?color=blue)
  • Hostname (www.example.com)
  • Sometimes headers (like Accept-Encoding) and cookies

Small cache key mistakes cause big problems:

  • Including irrelevant query parameters (like utm_source) explodes the cache into thousands of variants and destroys hit rate.
  • Varying on all cookies often makes HTML effectively uncacheable, because every visitor has a different cookie jar.
  • Missing a required vary dimension (like currency) can serve the wrong content to the wrong users.

Practical guidance: strip or ignore marketing query strings at the edge, and only include cookies in the cache key when the cookie changes the actual response.

The Website Owner's perspective
A "low cache hit rate" is rarely a mysterious CDN problem. It usually means your cache key is too unique (too many variants), so you're paying for a CDN without getting the speed or the origin offload benefits.

Cache-Control: how your origin communicates intent

Most caching behavior comes down to correct Cache-Control headers (see /academy/cache-control-headers/). The directives that matter most for edge caching strategy:

  • public vs private
    Public can be cached/shared; private should not be served across users.
  • max-age vs s-maxage
    s-maxage is for shared caches (CDNs) and can differ from browser caching.
  • stale-while-revalidate
    Lets the edge serve a slightly stale response while fetching a fresh one in the background – often a strong UX win for HTML.
  • no-store / no-cache
    Commonly used for sensitive flows; be careful not to apply them sitewide.

Also consider Vary. Overusing it (especially Vary: Cookie) can crater your cache efficiency.

What actually influences performance

Edge caching impacts multiple pieces of the critical path:

  • Lower server work (less origin rendering time)
  • Lower network latency (edge is geographically closer)
  • Often fewer slow connections to origin (depending on CDN configuration)

This typically improves TTFB, which then cascades into LCP and overall page load time. If you're working on above-the-fold rendering too, combine caching with /academy/critical-rendering-path/ work and /academy/critical-css/ decisions.

How to keep cached content fresh

Caching only helps if you can keep it "fresh enough" for your business. There are three common freshness models, and most mature sites use a mix.

1) TTL-only (simple, predictable)

You set a TTL and accept that content can be stale for up to that long.

Use TTL-only when:

  • Content changes infrequently (docs, posts)
  • Staleness is acceptable (category pages during normal days)

Risk:

  • Promotions, pricing, or inventory can look wrong until the TTL expires.

2) Purge/Invalidate (fast correctness)

You cache with a longer TTL, but when content changes you purge it.

Use purge when:

  • Product price changes should be reflected quickly
  • Campaign landing pages are updated frequently

Operational reality:

  • Your CMS, commerce platform, or deploy pipeline needs to trigger purges reliably.
  • Purging "everything" is a common anti-pattern; it causes a thundering herd of misses.

3) Stale-while-revalidate (best of both)

The edge serves cached content immediately, even if slightly stale, and refreshes in the background.

Use this when:

  • You want consistently fast pages under load
  • You can tolerate brief staleness (often seconds to a couple minutes)

This pattern is especially helpful for HTML on content-heavy sites.

Flowchart showing how edge caches decide hit, stale revalidate, or miss to originEdge caching behavior is mostly deterministic: cache key + freshness rules decide whether you get a hit, a stale hit, or a miss.

How to measure and interpret changes

If you change edge caching rules and your Core Web Vitals don't improve, you need to determine whether you fixed the bottleneck you actually have.

What to track

Track these together (not in isolation):

  1. TTFB: should drop for cacheable pages (see /academy/time-to-first-byte/)
  2. Cache hit rate: percentage of requests served from edge cache (HTML and static assets separately)
  3. Origin load: requests per second, CPU, and response times
  4. LCP on key templates: especially landing, category, product pages (see /academy/largest-contentful-paint/)
  5. Field vs lab differences: edge caching often looks better in real traffic than a single lab location (see /academy/field-data-vs-lab-data/ and /academy/chrome-user-experience-report/)

Reading the outcomes

Common patterns and what they mean:

Verifying in a waterfall

A network waterfall helps you confirm whether the document and critical assets are truly edge-cached and whether TTFB is improving for the right resources. If you use PageVitals, the documentation for the waterfall report is here: /docs/features/network-request-waterfall/. For interpreting TTFB specifically: /docs/metrics/time-to-first-byte/.

What you're looking for:

  • Response headers that indicate cache status (HIT/MISS/STALE, varies by CDN)
  • Lower and more consistent TTFB across repeat runs
  • Fewer expensive origin waits on the HTML document request

When edge caching breaks

Edge caching problems are usually not subtle. They show up as "wrong content" incidents or unexpectedly low hit rates.

Failure mode: caching personalized content

Symptoms:

  • Users see someone else's cart count or name
  • Logged-in banner appears for logged-out users

Fix:

  • Mark personalized responses private or bypass cache when specific cookies are present
  • Split pages into cacheable shell + uncached personalized calls (if your architecture supports it)

Failure mode: "we cache nothing because cookies exist"

Symptoms:

  • Every HTML request is a miss
  • CDN costs money but origin load doesn't drop

Fix:

  • Only vary/bypass on the cookies that change output
  • Consider stripping analytics cookies from cache consideration at the edge

Failure mode: staleness during promotions

Symptoms:

  • Promo banner lingers after campaign ends
  • Price updates take too long to appear

Fix:

  • Purge only affected paths/templates
  • Use shorter TTLs for promotion-sensitive pages
  • Prefer versioned assets and targeted invalidation rather than global purges

Heatmap table showing recommended TTL and cache variation by page type for ecommerceA simple policy matrix prevents the two most common mistakes: caching sensitive pages and failing to cache pages that are safe.

A practical rollout plan

If you want a strategy that survives real operations (deploys, campaigns, merchandising), implement in this order:

  1. Lock in static asset caching
    • Fingerprint filenames for CSS/JS bundles (often produced by your build tooling)
    • Set long TTLs and confirm Brotli is enabled (see /academy/brotli-compression/)
  2. Normalize cache keys
    • Strip or ignore UTM parameters
    • Ensure only meaningful query parameters affect caching
  3. Cache HTML for the pages that pay
    • Start with marketing pages and top landing pages
    • Then expand to category/product templates with short TTLs
  4. Add safe freshness controls
    • Purge on deploy/publish for known URLs
    • Consider stale-while-revalidate for stability
  5. Measure impact on TTFB and LCP

The Website Owner's perspective
The goal isn't "maximum caching." The goal is a stable, repeatable performance baseline that keeps conversion predictable during campaigns – without creating a new class of content correctness incidents.

How this connects to Core Web Vitals

Edge caching is rarely the only fix, but it's a foundational one because it improves the starting point of almost every navigation.

For context on how all these metrics relate, see /academy/core-web-vitals-overview/ and /academy/web-performance-metrics/.

Frequently asked questions

The biggest win is usually lower TTFB, especially for visitors far from your origin server. For cacheable HTML and API responses, it is common to see hundreds of milliseconds saved. That often improves LCP and overall conversion on mobile. Static assets typically become consistently fast worldwide.

For static assets like images, CSS, and JavaScript, aim for very high cache hit rates, often above 90 percent. For HTML on ecommerce, 50 to 80 percent can be strong depending on personalization and inventory rules. If your hit rate is low, the cause is usually cookies, query strings, or short TTLs.

It can if you cache pages that must be real time. The fix is not avoiding caching entirely, but using safer patterns: cache longer for static parts, keep real time fragments uncached, set short TTLs where needed, and purge on critical updates. Always test product and cart flows carefully.

Look for response headers that indicate cache status, then confirm with TTFB and waterfall timing in a synthetic test. A cache hit typically shows lower TTFB and fewer origin waits. Also watch consistency: edge hits tend to be stable across repeated tests, while origin responses fluctuate more.

No. Browser caching stores responses on the visitor device, while edge caching stores them on CDN servers close to visitors. Edge caching helps first time visitors and reduces origin load. Browser caching helps repeat visits on the same device. You typically want both, coordinated via Cache Control headers.