Careeroza
fetch Cache Options
Opting In
Next.js 15 changed the default: fetch requests are not cached unless you ask. The options:
| Option | Behaviour |
|---|---|
| (nothing) | Not cached. On a static route the data is fetched at build time; on a dynamic route on every request. |
cache: 'force-cache' | Cache forever (until revalidated by path or tag). |
cache: 'no-store' | Never cache; makes the route dynamic. |
next: { revalidate: 60 } | Cache, refresh after 60 seconds. |
next: { tags: ['products'] } | Label the entry so revalidateTag('products') can clear it. |
await fetch(url, { cache: 'force-cache' });
await fetch(url, { cache: 'no-store' });
await fetch(url, { next: { revalidate: 300 } });
await fetch(url, { next: { revalidate: 3600, tags: ['products', 'category-mobiles'] } });The Data Cache
Cached fetch results are stored in the Data Cache on the server (on disk in .next/cache, or in a shared store on Vercel). It survives across requests and deployments of the same build, so many users share one result.
Note: Cookies and auth headers make data user-specific. Never use force-cache for a request whose response depends on the logged-in user.