FlashcardNot attempted
Caching decision framework
Recall it before you reveal
Map each need to a caching tool: CDN caching, whole-page caching, fine-grained data control, instant updates, real-time.
Space to reveal
Show answer & explanation
- Global/CDN caching for an API → Cache-Control headers (s-maxage, stale-while-revalidate)
- Whole page rarely changes → export const revalidate = 3600 (ISR)
- Parts of the page with different freshness → fetch(..., { next: { revalidate } })
- Must update right after an admin change → tags + revalidateTag
- Must always be live → cache: 'no-store' (or client polling)
Next 15+: fetch is uncached by default, so caching is opt-in (force-cache, revalidate, or 'use cache' + cacheLife).
Common mistakes: relying only on revalidate (stale), only on headers (Next's own caches still serve stale data), mismatched TTLs (inconsistent UI).