Created
September 18, 2026 06:04
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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