Cache Storage API
A browser storage API that saves pairs of Request and Response objects in named caches, usually managed by a service worker.
In more detail
caches.open('v2') opens or creates a named cache, cache.put stores a response and cache.match looks one up by URL. It is fully under your code's control and ignores HTTP cache headers, so your code decides when entries expire.
Related terms
- service worker — A script the browser runs in the background, separate from pages, that can intercept a site's network requests and act as a programmable proxy.
- cache-first strategy — A caching strategy that answers from the cache when possible and only goes to the network, then caches the result, on a miss.
- network-first strategy — A caching strategy that tries the network first for fresh data and falls back to the cached copy only when the request fails.
- stale-while-revalidate — A caching strategy that answers immediately from the cache, even if out of date, while fetching a fresh copy in the background for next time.
- HTTP cache — A store that keeps HTTP responses and reuses them for later requests, following the rules the server sends in Cache-Control.
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