fetchCache (route segment config)

Overrides the default caching behavior of fetch() within a segment.

Since Next 13 (App Router) Spec ↗

Syntax

export const fetchCache = 'auto' | 'force-cache' | 'force-no-store' | ...

Returns

string — Default fetch cache policy for the segment.

Examples

// Force-cache every fetch in this segment regardless of options
export const fetchCache = 'force-cache'

export default async function Page() {
  const data = await fetch('https://api.example.com/data').then(
    (r) => r.json()
  )
  return <View data={data} />
}
// Never cache any fetch in this segment
export const fetchCache = 'force-no-store'

Notes

Advanced/rarely needed escape hatch — prefer per-`fetch` `cache` and `next.revalidate` options. Values include `auto` (default), `default-cache`, `only-cache`, `force-cache`, `default-no-store`, `only-no-store`, and `force-no-store`. `force-*` override individual fetch options; `only-*` error on conflicting ones.

See also