How do you choose the scope and timing of cache invalidation after a mutation?
Understand the idea, explain it in your own words and use the rubric to find your next learning gap.
The idea behind the question
Cache behavior depends on the Next.js version and configuration. A useful policy distinguishes data shared by many pages from user-specific views and defines whether a writer needs immediate fresh data.
Editing a product should update its detail view and relevant listings without evicting every unrelated cached page or sharing a private draft.
A practical way to learn it
Draw the affected data for a product edit, a listing and a private draft. Specify freshness requirements and one verification case for each reader.
Open Next.js project studioThe related tool opens separately; your interview answer stays here. Written practice is self-guided, without automatic code grading.
Build an explanation you understand
- State what the concept does in plain language.
- Apply it to the example and make your assumptions explicit.
- Explain a trade-off, failure case and how you would test it.
- Distinguish your actual experience from a proposed approach.
How would you explain it?
Single-question timers reset on refresh. Full mock sessions can resume from this browser.
Strengthen your explanation
Compare reasoning, not identical wording. Reference answers describe a possible approach; replace hypothetical statements with truthful details from your own work.
One way to answer
I would first identify which caches actually exist in the installed version, including whether Cache Components is enabled. I would map a mutation to affected data and routes and choose supported tag or path invalidation with deliberate freshness semantics. If the writer needs read-your-own-writes behavior, I would use an appropriate immediate-update mechanism rather than assume stale-while-revalidate guarantees it. Private data needs correct ownership and cache boundaries before invalidation is considered. Tests should include concurrent readers, related listings, failed mutations and deployment changes, with a fallback that avoids serving another user's data.
What a strong explanation should cover
Tick only the points your own answer addresses. This is self-assessment, not AI scoring.
0 / 3 points self-reportedWatch out for
- Copying a cache recipe without checking Next.js version or configuration.
Now go one level deeper
- When is a path invalidation broader than necessary?
- How would you test that a failed mutation leaves cached data consistent?
Further reading
Further-reading links support learning; the reference is Sukoaa-authored, not an official employer answer key.