mediumFrontend

How does fetch caching work in the Next.js App Router (force-cache, no-store, revalidate)?

908 views
01

Understand the problem

Controlling the Data Cache per fetch call.

nextjsfetchcachingrevalidate
02

Attempt it yourself

Sketch your approach before reading the solution — that's what interviews test.

Stuck? AI Nudge Available

Get a conceptual hint to guide your logic without spoiling the final implementation.

03

Study the solution

The solution is waiting

Give it an honest attempt first — then compare your thinking with the full walkthrough.

04

Read the code

Three caching intents
// stable reference data — cache forever
await fetch('https://api/countries', { cache: 'force-cache' });

// blog list — refresh at most every 10 min (ISR), taggable
await fetch('https://api/posts', { next: { revalidate: 600, tags: ['posts'] } });

// per-request/personalized — never cache (route becomes dynamic)
await fetch('https://api/me', { cache: 'no-store' });
05

Join the discussion

Discussion (0)

Sign in to join the discussion.

No responses yet. Be the first to share what you think.