←back to thread

Cache

(developer.mozilla.org)
147 points aanthonymax | 1 comments | | HN request time: 0s | source
Show context
zbuttram ◴[] No.45128919[source]
I almost used this recently to gain more control over the HTTP cache behavior in our app at work, but eventually realized what I wanted could be achieved by combining plain old cache headers with some more intelligent cache busting query strings. I would definitely like to see some more real-life examples where this API provides unique benefits over traditional cache handling.
replies(2): >>45129133 #>>45129760 #
runarberg ◴[] No.45129133[source]
This API is used heavily in service workers to store responses for offline use. I don‘t think you can use HTTP cache headers to robustly achieve the same effect.

I created an SRS based kanji learning app (https://shodoku.app/ https://github.com/runarberg/shodoku) hosted on GitHub Pages (meaning the app is a static HTML page) where all the dictionary data is stored as hundreds of thousands of json (and SVG) files. Storing these assets using the Cache API saves tens of thousands of round trips to the server in addition to offering a somewhat robust offline experience.

replies(1): >>45130612 #
1. moribvndvs ◴[] No.45130612[source]
This is a lovely app BTW