Next.js 16 use cache vs use cache: private and use cache: remote explained
A common Next.js 16 mistake is wrapping personalized data in a plain 'use cache' function, which fails at runtime because that directive cannot read request-time APIs like cookies. Developers often switch to 'use cache: private' to fix this, then wrongly apply it to shared data, causing unnecessary load on backend services. The article explains that Next.js 16 provides three caching directives, each answering a different question about scope and storage. It covers what each directive stores and where, how to choose among them for personal, shared-but-expensive, and general data, and the nesting rules governing which directives can wrap others. The guidance was written against Next.js 16.4.6 and both private and remote caches were introduced with Cache Components in version 16.0.0.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in