Overview

Service Worker caching (via the Cache API) provides much more control than standard browser caching. It allows developers to intercept every network request and decide exactly how to respond—whether from the cache, the network, or a combination of both.

Common Strategies

  • Cache First: Serve from cache, fallback to network. Ideal for static assets.
  • Network First: Try network, fallback to cache. Ideal for data that changes frequently.
  • Stale-While-Revalidate: Serve from cache immediately, then update the cache from the network in the background.

Importance

This is a core technology for building Progressive Web Apps (PWAs) and enabling offline functionality.

Related Terms