Topic: caching
-
Rolling out a service worker safely: scope, versioned caches, the waiting worker and a kill switch
A service worker that caches HTML can pin users to old code after a deploy. Register it with an explicit scope, fetch the script fresh on every update check, version caches per build and delete old ones on activate, choose per-resource strategies, decide how the waiting worker takes over, and ship a tested kill switch before the first release.
-
Cache-Control directives: max-age, no-store, private and stale-while-revalidate
Cache-Control tells browser and shared caches how long a response may be reused and where it may be stored: max-age and s-maxage set freshness, no-cache forces revalidation before reuse, no-store forbids storage, private keeps a response out of shared caches, and stale-while-revalidate and stale-if-error (RFC 5861) let a cache serve stale content while refreshing or during errors. A response without directives may still be cached heuristically.
Machine-readable: JSON