4.9.2. Stale Responses
4.9.2. Stale Responses
When a cached response becomes stale (its freshness lifetime has expired), it typically needs to be validated with the origin server before being used again. However, there are mechanisms that allow stale responses to be used under certain conditions.
Applications might want to use these mechanisms to improve availability or performance:
-
Cache-Control: stale-while-revalidateallows caches to serve stale responses while asynchronously revalidating them in the background. -
Cache-Control: stale-if-errorallows caches to serve stale responses if the origin server is unreachable.
See [RFC5861] for more information about these extensions.
Applications SHOULD consider whether allowing stale responses is appropriate for their use case. For some applications, serving stale data might be acceptable or even preferable to failing, while for others, it might not be.