←back to thread

Cache

(developer.mozilla.org)
147 points aanthonymax | 2 comments | | HN request time: 0.447s | 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 #
1. jeroenhd ◴[] No.45129760[source]
This API is pretty useful for writing web apps that also work offline/with bad connectivity. It saves you from re-implementing the browser fetching/resource loading logic the browser already does for you.

It's very powerful, which also makes it a footgun: you can end up with fetch() requests going out over the network, with server responses saying one thing, but the frontend receiving something completely differently.

As for examples, I believe Home Assistant uses it to cache pretty much every resource in the frontend pre-emptively so you can use the web UI even if your internet connection is down (but your connection to your home server isn't).

replies(1): >>45129937 #
2. arm32 ◴[] No.45129937[source]
We use service workers extensively in the kiosk app world.