allow service worker produced resources to be marked as "cachable"
Nobody has claimed this yet.
- Dominant language
- Bikeshed
- Stars
- 3.6k
- Forks
- 324
- Avg merge
- 14d 22h
- Merged PRs (30d)
- 1
Description
The main cache people think about in the browser is the http cache. Service worker sits on top of the http cache and all SW invoked fetch() calls go through it. This is well and good.
There are, however, additional caches within a browser. For example, both images and stylesheets have some form of memory caching spec'd within a document. These sit above the network and service worker layers.
It might be nice to provide a way for a service worker to indicate a particular Response won't change as long as the SW is in control. For example, a pre-cached asset. This would allow the browser to keep these assets in higher level memory caches. They could then be re-used without paying the cost of firing a FetchEvent or pulling the resource out of Cache API. These assets would have to be invalidated from the memory caches if the service worker became redundant (e.g. updates, unregister, etc).
You can see how effective these caches can be in https://github.com/w3c/ServiceWorker/issues/756#issuecomment-242217294. The benchmark loads from image cache anywhere from 35ms to 150ms. This is in comparison to the 300+ms required using a caching service worker.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the proposal in issue #962 and the linked benchmark discussion in ServiceWorker issue #756. Establish the browser cache layers and service-worker lifecycle cases described here; done would require a settled, specified mechanism for marking responses cacheable and defining invalidation when the service worker becomes redundant.
Written by the indexing model from the issue text.
Assessment
- Domain
- performance, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100