cacheLife

A Next.js function used inside use cache that sets how long the result stays fresh, when it revalidates and when it expires.

In more detail

Built-in profiles are default, seconds, minutes, hours, days, weeks and max, and you can define your own in next.config. Each profile has stale, revalidate and expire times.

Example

'use cache';
cacheLife('hours');

Related terms

Taught in

References