Course contentsShow
← Web Development
Lesson 1796 of 2,98233. Static Site Generation and JamstackFree lesson

Configuring Revalidation Intervals

Setting time-based revalidation windows to control how frequently pages check for updates and rebuild.

Configuring Revalidation Intervals

What you'll learn: How to set time-based windows that control when your statically generated pages check for updates and rebuild themselves.

The Core Idea

In Incremental Static Regeneration, you don't rebuild every page on every change—that would be slow and expensive. Instead, you configure a revalidation interval: a time period (in seconds) that tells your system "this page is fresh for X seconds, then check if it needs updating."

Think of it like milk with an expiration date. The carton is "good" for a set period, and only after that time do you check if you need fresh milk. Your static pages work the same way.

How It Works

When you set a revalidation interval (say, 60 seconds):

  1. First request: User gets the existing static page instantly (fast!)
  2. Within 60 seconds: All users get that same cached version
  3. After 60 seconds: The next user still gets the cached version, but triggers a background rebuild
  4. Subsequent requests: New users get the freshly regenerated page

This is the stale-while-revalidate pattern you learned earlier—users never wait for rebuilds.

Choosing the Right Interval

  • News sites: Short intervals (30-60 seconds) for timely updates
  • Product catalogs: Medium intervals (5-15 minutes) balancing freshness and build costs
  • Documentation: Longer intervals (hours/days) since content rarely changes
  • Marketing pages: Very long intervals (days/weeks) for stable content

The interval should match how often your content actually changes, not how often users visit.

Key Takeaway: Revalidation intervals let you balance content freshness with build performance by setting time windows that determine when pages check for updates—shorter intervals mean fresher content but more rebuilds, longer intervals mean fewer builds but potentially stale content.