Apex › Transport & web

Service Worker caching strategies

How a web app works offline and loads instantly. A Service Worker intercepts every fetch and answers by a policy you choose, trading off freshness, speed, and availability: cache-first (fast + offline, maybe stale), network-first (fresh, falls back offline), stale-while-revalidate (serve the cached copy now, refresh in the background), network-only, cache-only. Pick a strategy and toggle the network up/down and whether a copy is cached, and watch which source answers, whether it’s fast and fresh, and whether it revalidates — network-only offline breaks, cache-first serves stale, SWR does both.

More in Transport & web