Set a cached default
A route should cache fetches that do not declare a policy.
Next.js 16+ · Const
fetchCache is a route-segment export that overrides the default caching behavior of fetch requests in a layout or page. Its policy controls whether requests are cached, uncached, or required to follow one of those modes.
Declare fetchCache in a layout or page to set the default caching behavior for every fetch request in that route segment. Individual fetch calls can still provide their own cache option, while stricter modes can force or require caching or prevent it.
export const fetchCache = 'auto' | 'default-cache' | 'only-cache' | 'force-cache' | 'force-no-store' | 'default-no-store' | 'only-no-store'export const fetchCache = 'default-cache'
export default async function Page() {
const res = await fetch('https://api.example.com/products')
const products = await res.json()
return <pre>{JSON.stringify(products, null, 2)}</pre>
}This page makes uncategorized fetch requests cache by default within the route segment.
A route should cache fetches that do not declare a policy.
A route must reject uncached fetch calls.
A route must prevent all fetch caching.
fetchCache is a route-segment configuration that overrides the default cache option for fetch requests in a layout or page. Its value is one of the documented cache policies, such as auto, default-cache, or force-no-store.
Follow-up: How would you make every fetch cached unless a request explicitly opts out? Use only-cache, which changes an unspecified request to force-cache but errors when a request uses no-store.
auto preserves the normal behavior: fetches before Dynamic APIs use their supplied cache option, while fetches after Dynamic APIs are not cached. It is the default setting.
Follow-up: What happens if a request must be cached even after a Dynamic API? Use force-cache, which sets every fetch request's cache option to force-cache.
default-cache changes requests without an explicit cache option to force-cache, while requests that specify a cache option retain that choice. only-cache is stricter because it also rejects fetch calls using no-store.
Follow-up: When would default-no-store be preferable? Use it when unspecified requests should be uncached while explicitly configured cache behavior remains available.
cacheforce-cacheno-storeDynamic APIsRoute Segment Config