Re: [ServiceWorker] Pattern for handling fingerprinted assets in cache? (#657)

I'll explain why the implementation is hard below, but if we can make this use case easier it will help developers adopt SW's faster.  VARY headers are harder to configure and understand.  Search URL components are not very restful and don't seem to fit what is often done today.  Currently the only other option is to do cache.keys() and manually search.

I wonder if we could add a simple string "tag" to a request and then let `match(request, { tag: "foo" })` only return results that also have tag="foo"?  What do you think about that option @jakearchibald?

---

The implementation problem with `prefixMatch`, or anything that does a regex on the url automatically, is that its hard to achieve all of the following:

1) Fast
2) Uses reasonable disk space
3) Uses reasonable runtime memory

We either have to create an index on the URL in our storage DB, which can use a lot of disk space, or we have to keep everything in memory to scan it quickly.  It just kind of suck. :-(

Exact matches are not as bad because we can hash them which keeps the DB index a reasonable size.


---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/657#issuecomment-82989693

Received on Wednesday, 18 March 2015 14:09:55 UTC