Browser internals·Intermediate·Conceptual·1 min read
What's the practical difference between cache-first, network-first, and stale-while-revalidate?
Short interview answer
Cache-first checks the cache and only goes to the network on a miss, favoring speed and offline availability over freshness, appropriate for a static app shell. Network-first tries the network first and falls back to cache on failure, favoring freshness while staying usable offline. Stale-while-revalidate returns the cached response immediately for speed, then fetches in the background to update the cache for next time.
Key takeaway
Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.