workbox icon indicating copy to clipboard operation
workbox copied to clipboard

Request to clarify documentation Stale-While-Revalidate

Open TheNewSound opened this issue 2 years ago • 0 comments

Library Affected: workbox-strategies

Browser & Platform:

Issue or Feature Request Description: This is a request to update the documentation of the Stale-While-Revalidate strategy and possibly other strategies as well (e.g. Network-First). https://developer.chrome.com/docs/workbox/modules/workbox-strategies#stale-while-revalidate

From other information (e.g. on web.dev) it is clear that the Service-Worker Cache is in front of the HTTP Cache. The documentation on stale-while-revalidate of workbox mentions: "this strategy will always make a revalidation request, regardless of the age of the cached response" and "The network request is then used to update the cache", but does not explicitly mention if the HTTP Cache is bypassed or not. From the cache hierarchy I infer that when the Service-Worker makes a network request, it is still up to the HTTP Cache to serve a cached response or to truly make a request over the network.

Some clarification would be appreciated on whether the HTTP Cache is bypassed and Stale-While-Revalidate truly sends a network request (to the server), or whether the HTTP Cache is still allowed to sent a 'fresh' cached response (e.g. age < max-age) and not actually revalidate with the server.

The pictures also depict 'network' but it would be more accurate to show the HTTP Cache in front of the 'Network' if the workbox strategies do not bypass the HTTP Cache.

TheNewSound avatar Dec 28 '23 00:12 TheNewSound