cache versioning
Putting a version in each cache's name, such as static-v2, so a new service worker fills a new cache and deletes old ones on activate.
In more detail
When the service worker's activate event runs, it lists all cache names and deletes the ones that do not match the current version. It prevents pages from mixing files from two releases and stops old caches filling the user's disk.
Related terms
- Cache Storage API — A browser storage API that saves pairs of Request and Response objects in named caches, usually managed by a service worker.
- service worker lifecycle — The states a service worker passes through: installing, installed and waiting, activating, activated, and finally redundant when replaced or failed.
Taught in
- Service Worker Lifecycle: Installation, Activation And Update — Frontend Architecture & Web Platform
- Cache Storage API: Offline Strategies And Cache-First Patterns — Frontend Architecture & Web Platform