max-age
The Cache-Control directive that says how many seconds a stored response stays fresh.
In more detail
With max-age=0 a cache may keep the answer but must validate it with the server before every reuse. Larger values let caches answer without contacting the server at all until the time runs out.
Related terms
- Cache-Control — The HTTP header that states the caching policy for a response, such as private, max-age=0 or no-store.
- freshness — Whether a cached response may still be used without asking the server: fresh means yes, stale means it must be checked or fetched again.
- cache validation — Asking the server whether a stored response is still current by sending back its validator, such as an ETag, in a conditional request.
Taught in
- Caching And Conditional Requests — Modern API Architecture: REST, GraphQL & gRPC
- The Fetch API: Streaming Responses, HTTP Caching And Keepalive — Frontend Architecture & Web Platform