Skip to content
Latchkey

What Is Stale-While-Revalidate?

Stale-while-revalidate is a caching pattern where a cached value is returned right away, even if slightly out of date, while an asynchronous request updates the cache in the background. The next request then sees the refreshed value. It trades a small staleness window for consistently fast responses.

Why it matters

Always revalidating before responding adds latency on every request; never revalidating risks serving stale data forever. Stale-while-revalidate keeps responses instant while still converging on fresh data.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →