- 
                Notifications
    
You must be signed in to change notification settings  - Fork 858
 
Description
Library Affected:
workbox-strategies
Browser & Platform:
all browsers
Feature Request Description:
The stale-while-revalidate Cache-Control Extension
When present in an HTTP response, the stale-while-revalidate Cache-
Control extension indicates that caches MAY serve the response in
which it appears after it becomes stale, up to the indicated number
of seconds.
https://tools.ietf.org/html/rfc5861#section-3
The current implementation of the stale-while-revalidate is very inflexible and just assumes the current cache content is always stale.
Normally I would use this strategy alongside an indication, when the cache content should be consider stale. For example Firefox and Chrome support stale-while-revalidate next to max-age. We use a similar solution with our varnish layer.
Our your goal is to leverage the local cache and reduce the load (requests) on the origin.
This is why I propose an option for the stale-while-revalidate strategy that allows you to set a number of second during which the cache is considered fresh.
This option in combination with the ExpirationPlugin (how long stale content is allowed be serve...) gives us a complete implementation of stale-while-revalidate.