Deviopath › Next.js

Is the Page Stale?

Easy · Caching

With Incremental Static Regeneration (ISR), a page can export const revalidate = 60: the generated page is reused, and once it is older than 60 seconds Next.js generates a fresh version in the background. revalidate = false means the page is cached forever, and revalidate = 0 means it is never cached (rendered on every request).

Write isStale(generatedAt, now, revalidate). generatedAt and now are timestamps in **milliseconds**; revalidate is in **seconds** or false.

- false: never stale

- 0: always stale

- a number: stale when **more than** revalidate seconds have passed since generatedAt

Simplified model of the real cache.

Next: Server or Client Component?