Skip to solution
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.

Nudge consolestandby

Stuck? Beam a request up — the console returns a conceptual nudge that guides your logic without spoiling the implementation.

03

Study the solution

fetch options control caching: { cache: 'force-cache' } caches indefinitely, { cache: 'no-store' } never caches (dynamic), and { next: { revalidate: N } } caches but revalidates after N seconds (ISR). next: { tags } enables on-demand invalidation.

Solution ready — 2 min read

Classified // press E to declassify

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.

Transmission complete // awaiting log

KEEP THE
STREAK ALIVE.

Dossier 29 of 95 decoded in the Next.js track. One more won't hurt.

Back to track