Understanding the Caching Model

Caching in Next.js is not a single global cache. Different layers can exist, including browser caching, CDN caching, server-side data caching, request memoization, and application-level caches.

When debugging stale data, ask which layer contains the stale value. A page can appear stale because the data request is cached, because generated output is reused, or because an external CDN retains a response.

Caching should be intentional. Sensitive user-specific responses should not accidentally be shared across users.

Typical Caching Layers
Key Takeaways
  • Caching has multiple layers.
  • Always identify which layer is producing stale content.
  • User-specific data requires careful cache boundaries.