Cache API
caches.default stores the worker's own response. The first request generates a payload, the next ones are served from the cache, and purging makes the next request a miss again.
caches.defaultcache.MatchAsynccache.PutAsynccache.DeleteAsync
Cache key
The full request URL is the cache key, so two different keys are cached independently. Change the key and the sample starts with a miss again.
Press βRequestβ twice to watch
x-cache flip from miss to hit.
Result
No call yet. Send a GET request to generate and store the entry.
What the worker does
1. Match
cache.MatchAsync(url)
β
2. Hit
stored response replayed
β
3. Miss, build and store
context.WaitUntil(cache.PutAsync(β¦))
β
4. Purge
cache.DeleteAsync(url)
The stored copy carries cache-control: max-age=300; without it the Cache API quietly
refuses to keep the response. The copy sent to this browser carries cache-control: no-store,
so every click really reaches the worker and the hit/miss flip stays visible.
Calls made from this page
No calls yet.