Controlling what is stored and for how long.
WHAT CONTROLS CACHING
Response headers stating how long, and by whom, content may be cached.
WHAT PUBLIC AND PRIVATE MEAN
Public: may be stored by shared caches
Private: may be stored only by the user's own browser
WHAT NO-STORE MEANS
Not to be stored anywhere.
WHAT TO USE FOR PERSONALISED CONTENT
Private, or no-store where it is sensitive.
WHAT VALIDATION HEADERS PROVIDE
A way to check whether a cached copy is still current, without retransmitting it.
WHAT THAT SAVES
Bandwidth, on every request for unchanged content.
WHAT VERSIONED FILENAMES ACHIEVE
Content at a given address never changing, so it can be cached indefinitely.
WHY THAT IS THE BEST PATTERN
Changes appear immediately because the address changes, and nothing needs purging.
WHAT STALE-WHILE-REVALIDATE DOES
Serves a slightly stale copy while fetching a fresh one.
WHAT THAT IMPROVES
Perceived speed, and resilience when the origin is slow.
WHAT TO DO ABOUT PURGING
Treat it as an exception, not a routine mechanism.
WHAT TO NEVER CACHE PUBLICLY
Anything varying by user.
WHAT TO TEST
Whether a signed-in user's content can be served to someone else.