sw-toolbox icon indicating copy to clipboard operation
sw-toolbox copied to clipboard

Emulate stale-while-revalidate?

Open jeffposnick opened this issue 9 years ago • 2 comments

stale-while-revalidate is an HTTP caching header that isn't widely honored by user agents, but might get some actual use "in the wild" in HTTP responses.

@igrigorik suggested that we might want to make sw-toolbox emulate stale-while-revalidate semantics when it's present. This would presumably only apply for any runtime strategy that involves a fetch(), but we'd have to give that more thought.

jeffposnick avatar May 16 '16 23:05 jeffposnick

Browsers will probably implement this eventually (Chrome info) so this would need to work with and without native support.

stale-if-error would be interesting to implement too.

ithinkihaveacat avatar May 17 '16 00:05 ithinkihaveacat

@jeffposnick I noticed at clients that having always fresh content is really important and that toolbox.fastest just isn't enough. I don't know what emulating stale-while-revalidate really means, but I created a stale-while-revalidate recipe with sw-toolbox. Would you be interested in a PR where I make this an actual strategy in sw-toolbox? Either way, what do you think about this approach? You can find it in this repo.

decrek avatar Mar 02 '17 10:03 decrek