The copies shelf: cache.put, match, keys and delete on the real Cache API. What happens to a body already read, a stale copy, and the shelves of old releases?…
This is what an offline PWA stands on. Its mistakes are real too: an empty reply because cache.put already read its body, stale data forever because the Cache API does not read Cache-Control, a site quota swelling because old versions’ caches are never deleted.
The key is the Request, not an HTTP header; its lifetime is yours
res.clone() before cache.put() A Response body can be read only once, and cache.put reads it to the end. Keep cache.put(url, res.clone()), then return res.caches follows the Cache-Control header No. CacheStorage never expires by itself and has no TTL. A copy stays until you cache.delete() it or rename the cache each version.v1 → v2); delete the old ones in the service worker’s activate event, but not the current version’s.cache.put(url, res), then read res TypeError: its body is already used.max-age=0 copy, then match It still comes out, 30 days later too.