These directives tell caches whether they may store a response, for how long, and when they must check with the server.
max-age=N makes the response fresh for N seconds. While it is fresh, caches can reuse it without contacting the server. s-maxage does the same, but only for shared caches like CDNs.
no-cache allows storing, but the cache must revalidate with the server before each use. no-store forbids storing the response at all. It suits sensitive data.
private means only the user's browser may cache the response, not shared caches. public allows shared caches to store it. This includes some cases where they normally wouldn't, such as authenticated requests.
immutable says the content will never change while it is fresh. So the browser should not revalidate it, even when the user reloads. It fits hashed asset files like app.3f9a1c.js.
stale-while-revalidate=N lets a cache serve a stale (expired) response for up to N seconds after it expires. Meanwhile, the cache fetches a fresh copy in the background.
max-agesets how long a response stays fresh.no-cachemeans revalidate before each use, andno-storemeans never store.privatekeeps the response out of shared caches, andpublicallows them.immutableis for hashed assets that never change.stale-while-revalidateserves the stale copy while it fetches an update.