Cache-Control

The HTTP header that states the caching policy for a response, such as private, max-age=0 or no-store.

In more detail

It is a policy, not a storage command: it says who may keep the answer, for how long it stays fresh, and whether it must be checked again. Common directives are max-age for how many seconds a response stays fresh, private for one user only, no-cache for revalidate before use, and no-store for never keep a copy.

Examples

In the APIs course: The course service sends private, max-age=0 on task reads, so only a private cache may keep them and must revalidate before each reuse, and no-store on errors and authentication answers.
Cache-Control: private, max-age=0
Cache-Control: no-store
In the browser: max-age=31536000, immutable says the file is fresh for a year and will never change, ideal for hashed assets. no-cache means a copy may be stored but must be revalidated with the server before each use, and no-store means never store it.

Related terms

Taught in

References