04 / 08

Discuss revalidating strategies for data caching?

Difficulty: 6/10
ISR, SWR, on-demand revalidation
Cached data can be revalidated in two ways, with:
  1. 1

    Time-based Revalidation: Revalidate data after a certain amount of time has passed and a new request is made. This is useful for data that changes infrequently and freshness is not as critical.

  2. 2

    On-demand Revalidation: Revalidate data based on an event (e.g. form submission). On-demand revalidation can use a tag-based or path-based approach to revalidate groups of data at once. This is useful when you want to ensure the latest data is shown as soon as possible (e.g. when content from your headless CMS is updated).

Time based revalidation

Data can be revalidated on-demand by path (revalidatePath) or by cache tag (revalidateTag).

Scenario Questions

0-2 years experience

  1. 1If you add `revalidate: 60` to `getStaticProps` for a page, what happens when a user visits that page after two minutes of inactivity?
  2. 2How would you use the `useSWR` hook to make a component show fresh data without forcing a full page reload?
  3. 3What does the `fallback` option do when you combine `getStaticPaths` with ISR?

2-5 years experience

  1. 1Your product page uses ISR with `revalidate: 300`, but after a promotion ends the page still shows the old price for a while. How would you troubleshoot and fix it?
  2. 2Explain the trade‑offs between setting a `revalidate` interval in `getStaticProps` versus calling an API route that triggers on‑demand revalidation.
  3. 3A user reports that after a content update the page still shows the previous version. Walk me through how you’d debug the caching layers in Next.js.

5-8 years experience

  1. 1Design a caching strategy for a high‑traffic news site that needs fast initial loads and up‑to‑the‑minute freshness. Include ISR, SWR, and edge‑cache considerations.
  2. 2How would you implement on‑demand revalidation for user‑generated content while preventing excessive or abusive revalidation calls?
  3. 3Discuss the performance and cost impact of setting a very low `revalidate` interval on Vercel’s edge network and how you’d mitigate any downsides.

8+ years experience

  1. 1Your organization is migrating a monolithic Next.js app to a micro‑frontend architecture. How would you standardize revalidation strategies across teams to balance consistency, latency, and operational overhead?
  2. 2For a global e‑commerce platform with region‑specific product data, design a multi‑region caching and revalidation system that respects local regulations and minimizes stale data.
  3. 3What governance processes would you put in place to monitor and audit on‑demand revalidation usage across dozens of services?

Follow-up Questions

  • What metrics would you set up to know if your revalidation strategy is meeting freshness goals?
  • How would you protect an on‑demand revalidation endpoint from abuse?
  • Can you describe how you’d observe cache hit/miss rates across the edge network?
Share

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.