TTL (time to live)

TTL is how long a cached object counts as fresh. While the TTL runs, a cache answers from its copy without asking the origin; once it expires, the next request triggers a revalidation or a full refetch. In HTTP caching the TTL comes from Cache-Control (max-age for everyone, s-maxage for CDNs), from CDN edge rules that override headers, or from CDN defaults when nothing is set.

Where the number comes from (precedence)

  1. CDN rule / dashboard setting (e.g. "Edge Cache TTL") — beats headers where configured.
  2. Vendor cache headers (Cloudflare-CDN-Cache-Control, Surrogate-Control).
  3. CDN-Cache-Control, then s-maxage, then max-age, then Expires.
  4. CDN default heuristics — often surprisingly short for HTML, or no caching at all.

What happens at expiry

Expiry doesn't delete the object — it marks it stale. What follows depends on configuration: a conditional revalidation via ETag (cheap, but still an origin round trip), a full refetch, or — with stale-while-revalidate — an instant stale answer plus background refresh.

TTL is a ceiling, not a promise

Two things end a cache entry's life early. A purge removes it deliberately. Eviction removes it because the PoP needed the space — and it hits unevenly: in our 408,000-request measurement some edge locations lost up to 9.4% of warmed objects between hourly passes despite generous TTLs, while others lost none. Which is why TTL strategy and warming schedule belong together: the TTL sets the theoretical lifetime, warming restores the entries reality takes away. Check any URL's actual TTL headers and edge status with the cache checker.