Explain Network First vs Cache First caching and when to use each

Tests matching caching strategy to asset freshness. Cache First serves static assets from the Cache API, falling back to network. Network First fetches fresh content, falling back to cache offline.
What's really being asked
Your ability to reason about the tradeoff between freshness and availability in a service worker, and to map specific caching strategies to the correct asset types. Interviewers want to see that you understand the Cache API is a high-level JavaScript-driven cache separate from the HTTP cache, and that you know how fetch event interception enables different request handling patterns.
The full answer
Four things in order. First, a clear definition of Cache First as a strategy where the service worker calls Cache.match first and returns the cached response immediately if found, only falling back to fetch if there is a cache miss. Second, a scenario for Cache First such as static assets with hashed filenames or immutable images where speed matters more than freshness. Third, a clear definition of Network First as a strategy where the service worker attempts fetch first and returns the network response if successful, only falling back to the cache if the network is unreachable or slow. Fourth, a scenario for Network First such as an HTML document or a JSON API response where the user needs the latest content but still requires offline functionality.
The mistakes people make
Three red flags stand out. One, conflating the Cache API with the HTTP cache and claiming that Cache-Control headers directly control the service worker cache. Two, recommending Cache First for rapidly changing data like a stock ticker or a social media feed because this guarantees stale content. Three, describing Network First for large static assets without mentioning the performance cost or the need for a timeout, since waiting for a network round trip on every request would defeat the purpose of caching.
What usually comes next
The interviewer may ask how you would implement a timeout for Network First to avoid waiting forever on a slow connection. They might also ask about Stale While Revalidate as a hybrid alternative, or how to update the cache after a Network First fallback so that subsequent offline requests have slightly fresher content. Another common pivot is asking how you would precache assets during the install event versus runtime caching.
A concrete example
Imagine a news PWA. For the article images and the compiled app.js bundle with a content hash in the filename, Cache First is appropriate because these files never change and should load instantly. For the top headlines API endpoint and the article HTML shell, Network First is better because readers want the latest stories, but if they are on a subway they should still see the morning headlines from cache rather than an error page.
Interview question
When building a news PWA, which asset should use a Cache First strategy?
- a.The live stock ticker feed where updates arrive every second
- b.The headlines API endpoint where readers need the latest stories
- c.The compiled app.js bundle with a content hash in its filenameCorrect
- d.All assets governed by Cache-Control headers in the browser's HTTP cache
Why? this is the answer
Cache First is ideal for immutable hashed bundles because they never change and should load instantly from the Cache API. Option B describes a Network First scenario, since headlines require the latest content but still need offline fallback.
Just read this? Test yourself on what you have been reading.
Read the original → developer.chrome.com
- #service worker
- #caching
- #pwa
- #workbox
- #offline
You just looked this up. Could you explain it out loud?
That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles