In the Next.js App Router you set export const revalidate = 3600 in a page or route segment, where the number is seconds. The framework caches the rendered output (the HTML plus the React Server Component payload and any fetch results) on the server and at the edge.
When a request arrives after the revalidate window has passed, Next.js returns the cached page and triggers a regeneration job. That job re-runs the server component, re-fetches data, and atomically swaps the cache entry. If regeneration fails, the old page keeps serving, so a broken data source does not take the page down.
Beyond time-based revalidation, Next.js supports on-demand revalidation. You call revalidatePath('/lessons/latency') or revalidateTag('courses') from a server action or webhook, and only the affected pages are invalidated. This is how a CMS publish button or a Stripe webhook can refresh exactly the pages that changed within seconds, with no redeploy.