Next.js extends fetch with a Data Cache and tools to revalidate stale content—static speed with fresher data when you need it.
Time-based revalidation
fetch(url, { next: { revalidate: 3600 } }); // ISR: refresh at most every hour
On-demand revalidation
import { revalidatePath, revalidateTag } from 'next/cache';
// After a mutation:
revalidatePath('/blog');
revalidateTag('posts');
Tag fetches with next: { tags: ['posts'] } and bust cache when content changes.
Opting out of cache
fetch(url, { cache: 'no-store' }); // always fresh — dynamic rendering
Mental model
- Static — build time, shared across users
- Dynamic — per-request when using cookies, headers, or no-store
- Revalidated — cached but refreshed on a timer or after mutations
Self-check
- When would you use
revalidate: 60vscache: 'no-store'? - What triggers on-demand revalidation after an admin edit?
Tip: Tag fetches with next: { tags: ['posts'] } and call revalidateTag after admin edits—cleaner than blanket no-store.
Interview prep
- revalidate vs no-store?
revalidate: Ncaches with timed refresh (ISR);cache: no-storefetches fresh every request—dynamic, personalized routes.