Next.js
Caching
App Router uses multi-level caching: full-route, RSC, and fetch cache. Cache choices drive SSG, ISR, or SSR.
Full-route cache
- Caches HTML + RSC payload.
- Auto-enabled when no dynamic inputs are used.
- Controls:
export const dynamic = "force-static",export const revalidate = N. - Good for marketing pages, blogs, docs.
RSC cache
- Caches server component output.
- Skipped when reading cookies/headers, using
no-store, or serving user-specific data.
Fetch cache
- Each
fetch()in RSC has a cache policy. cache: "force-cache"(default),cache: "no-store",next: { revalidate: N }.
fetch("https://api.example.com", { next: { revalidate: 60 } });How levels interact
- Fetch cache → RSC cache → full-route cache.
- Any dynamic element punches through to SSR.