This page is statically generated but re-validates every 30 seconds. The data below was frozen at cache time — but the cache expires and silently regenerates in the background.
↑ Values change on re-validation (every 30s), not on every request. First request after 30s triggers background regeneration — users never wait.
// revalidate = 30 (seconds)
// T=0s → Page built, cache filled
// T=10s → Request → CACHE HIT (instant)
// T=31s → Request → CACHE HIT (still served!)
// + background regeneration triggered
// T=32s → Request → NEW cache filled
// T=33s → Request → CACHE HIT (new data)// Option 1: Page-level revalidation
export const revalidate = 30; // seconds
// Option 2: Per-fetch revalidation
const data = await fetch("https://api.example.com/stats", {
next: { revalidate: 30 } // per-request ISR
});
// Option 3: On-demand revalidation (e.g. on CMS publish)
import { revalidatePath, revalidateTag } from "next/cache";
revalidatePath("/products"); // in a Server Action or Route Handlerexport async function getStaticProps() {
const data = await fetchStats();
return {
props: { data },
revalidate: 30, // ← the ISR magic in Pages Router
};
}