TTL and Cache-Control
We decide when a retained response may be reused without contacting its source. Stored bytes do not become fresh again merely because another cache received them. We will compute age, distinguish shared and private policies, revalidate conditionally, and bound stale service.
#Section 5TTL is a freshness rule, not guaranteed retention
A clip response is stored, then removed early because the edge needs space. A score response is still stored but too old to use without validation. Time to live, or TTL, commonly describes a freshness interval in this context; it does not guarantee that the cache will retain an entry for that whole period.
HTTP caches compare a response’s current age against its allowed freshness lifetime using protocol rules and policy. A fresh entry can be reused without ordinary origin validation, subject to other request conditions. An expired retained entry can still help through conditional validation or a permitted stale mode; absent bytes cannot.
Check the CDN’s minimum and maximum configured TTL as well as origin directives. Configuration can constrain what the edge does. Heron should use a deliberate immutable-media policy and a separate score freshness policy because score updates and immutable video bytes change differently.
#Section 6Compute current age across cache layers
An edge receives a response whose corrected initial age is an illustrative 120 seconds. The allowed freshness lifetime is 300 seconds. Only 180 fresh seconds remain; assigning a new 300-second lifetime from local receipt would forget the age already spent upstream.
In this simplified trace, residence adds directly to corrected initial age. After 240 seconds at the edge, current age is 360 and the response is 60 seconds past its 300-second lifetime. Real HTTP corrected age includes the protocol’s response-delay and clock rules, so use the standard or implementation rather than only wall-clock subtraction.
Read this as current age equals corrected initial age plus time resident in this cache. Here is already corrected for upstream and response timing; is elapsed local residence. RFC 9111 defines the complete freshness and age calculation.
#Section 7Cache-Control, private caches, and shared caches
Heron wants a public asset to stay fresh in a browser for an illustrative 60 seconds but in a shared CDN for 300. max-age and s-maxage can express distinct HTTP freshness rules for those scopes, subject to the other directives and actual cache configuration.
A private cache is dedicated to one user, while a shared cache can reuse responses across users. private prevents ordinary shared storage of a response under its rules. no-store forbids storing under the directive’s scope. no-cache means reuse requires successful validation; it does not simply mean never retain bytes.
Personalized responses need careful scope. A public score representation may be reusable across authorized viewers, while a personal account page must not become a shared public response. Some authenticated responses can be cached under explicit permitted rules, but a design should justify that choice rather than treating credentials as irrelevant.
#Section 8Conditional validation and stale windows
An expired entry has an ETag for its exact representation. The edge sends a conditional request such as If-None-Match. If the origin reports that representation unchanged, a 304 response permits the cache to update the relevant metadata and reuse retained content under the protocol rules, avoiding retransmission of the full body.
Stale-while-revalidate permits a bounded stale reuse while refresh happens, and stale-if-error permits selected stale reuse during specified failures when allowed. RFC 5861 defines these extensions. They are explicit policy, not permission to serve arbitrarily old or unauthorized content.
With lifetime 300 seconds and a 30-second stale-if-error allowance, illustrative age 320 is 20 seconds stale and fits. Age 340 is 40 seconds stale and exceeds that allowance. Permission, deletion, and directives that require validation can impose tighter conditions; stale service cannot weaken them.