VCF

Unit 9 · Ship it and keep it alive

Reading cache headers: HIT, age and cache-control

A cache HIT means the CDN had a stored copy and served it. age is how old that copy is, in seconds. cache-control says how long the copy may be kept.

The mix-up

What people often think

“HIT means the copy has expired.”

What the tutor says

HIT means the CDN had a copy and used it. cache-control says how long it may keep that copy.

How it works

age is not downtime: a site that is down does not answer 200 at all. A large age on a page that should have changed points at a stale cache.

An example

What worksHTTP
HTTP/2 200
cache-control: public, max-age=3600
x-cache: HIT
age: 2950
Served from the CDN; this copy is about 49 minutes old.

Close cousins of this mix-up

The tutor watches for these in the same lesson.

  • “The age header counts how long the site has been down.”

    A down site does not answer 200. age is how old the copy you got is, in seconds.

Practise it with a tutor watching

Caches

Tell stale from broken by reading cache headers, then clear the right cache instead of redeploying blindly.

25 minutes See it Build it Say it
Start the lesson

Free, no account needed.