Answer
What is the difference between cache-first and network-first caching?
Cache-first checks the cache first and only goes to the network if there is no cached match — best for static assets like fonts and logos that rarely change. Network-first always tries the network first and falls back to the cache only if the request fails — best for content that should be as fresh as possible, like an API response, while still working offline.
When to use cache-first
Versioned, immutable static assets (hashed JS/CSS bundles, icons, fonts) where staleness is never a concern once cached.
When to use network-first
API responses, article content, or anything users expect to be current — the network is tried first with a timeout, and only offline users see the cached copy.
Stale-while-revalidate
A third common strategy returns the cached response immediately for speed, then fetches a fresh copy in the background to update the cache for next time.