'use cache'

A Next.js directive that caches the result of a function, component or whole route, with its arguments forming the cache key.

In more detail

In Next.js 15 it is experimental and needs the dynamicIO or useCache flag in next.config. Set the lifetime with cacheLife and labels with cacheTag. Later versions made it the main caching model under the cacheComponents option.

Related terms

Taught in

References