I was trying to look for docs and libraries about a cache akin to RFC 5861 where objects can be in three age states, fresh and expired (as usual), and a third where it can be returned immediately (as though fresh), but asynchronously checked (as though expired).

Is this a named pattern? What should be searching for to find literature on this outside of the HTTP realm?

3.1. Example

A response containing:

Cache-Control: max-age=600, stale-while-revalidate=30

indicates that it is fresh for 600 seconds, and it may continue to be served stale for up to an additional 30 seconds while an asynchronous validation is attempted. If validation is inconclusive, or if there is not traffic that triggers it, after 30 seconds the stale-while-revalidate function will cease to operate, and the cached response will be "truly" stale (i.e., the next request will block and be handled normally).

  • $\begingroup$ I had the exact same question. Although "stale-while-revalidate" (SWR) is a valid name, I think there could be a better one out there... $\endgroup$ Jul 9 at 17:20


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.