Master HTTP caching terminology — Cache-Control directives including max-age, no-store, and stale-while-revalidate, ETag-based conditional requests, and the Vary header for cache key differentiation.
0 / 5 completed
1 / 5
What does Cache-Control: max-age=3600 tell a browser or CDN?
max-age specifies the freshness lifetime in seconds from the time the response was received. A cached response with max-age=3600 is considered fresh for one hour; after that the cache must revalidate with the origin before serving it again.
2 / 5
What does Cache-Control: no-store do?
no-store is the strongest cache directive — it prohibits caching the response entirely. It is appropriate for sensitive data (bank statements, health records) where even a local browser cache copy is undesirable. It differs from no-cache, which allows storage but requires revalidation before each use.
3 / 5
What does stale-while-revalidate enable in HTTP caching?
stale-while-revalidate=N tells a cache it may serve a stale response for up to N seconds while asynchronously revalidating in the background. The user gets an instant (possibly slightly outdated) response, and the next request gets the refreshed version — a common pattern for high-traffic, frequently-updated resources.
4 / 5
How does an ETag enable conditional HTTP requests?
ETag is a fingerprint (hash or version token) for a resource. On revalidation the browser sends If-None-Match: "abc123"; if the ETag still matches, the server replies with 304 Not Modified and no body, saving bandwidth while confirming the cached copy is still current.
5 / 5
What is the role of the Vary response header in caching?
The Vary header defines which request headers the response depends on. Vary: Accept-Encoding means the cache stores separate copies for gzip and non-gzip clients. Vary: Accept-Language caches per language. Using Vary: * effectively disables caching by declaring the response unique per request.