Skip to content

Instantly share code, notes, and snippets.

@pfftdammitchris
Created September 18, 2026 06:04
Show Gist options
  • Select an option

  • Save pfftdammitchris/b71d0140ec028e6468d9202ad3afbfb1 to your computer and use it in GitHub Desktop.

Select an option

Save pfftdammitchris/b71d0140ec028e6468d9202ad3afbfb1 to your computer and use it in GitHub Desktop.
Next.js Caching Mental Model in 2026: Request Memoization, Data Cache, Full Route Cache, and Router Cache Explained Once and for All - snippet-2.ts
// Cached indefinitely until manual invalidation
const product = await fetch('https://api.example.com/products/123').then(r => r.json());
// Revalidated every 60 seconds
const inventory = await fetch('https://api.example.com/inventory', {
next: { revalidate: 60 }
}).then(r => r.json());
// Never cached
const user = await fetch('https://api.example.com/user', {
cache: 'no-store'
}).then(r => r.json());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment