Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

You can "modify" entries in the cache api #2

Open
jakearchibald opened this issue Aug 14, 2016 · 5 comments
Open

You can "modify" entries in the cache api #2

jakearchibald opened this issue Aug 14, 2016 · 5 comments

Comments

@jakearchibald
Copy link

caches.open(name)
  .then(c => c.put("/", new Response("lololol")));

In cache storage, the requests & responses can be mismatched in terms of their original fetching, or either/both can be of your own making.

@gmetais
Copy link
Owner

gmetais commented Aug 14, 2016

Oh great! I don't understand how I missed that.

I'll make this change, but now I need to find a way to store the version number. IndexedDB was interesting for this!

@jakearchibald
Copy link
Author

You could put metadata in headers, but it could be that indexeddb is a better fit.

@gmetais
Copy link
Owner

gmetais commented Aug 14, 2016

I like the idea of storing the info inside the headers. A unique request to Cache is better than 2 requests to Cache + IDB.

@robdodson
Copy link

robdodson commented Aug 14, 2016

It may be good to update the part of the readme that talks about IDB to mention this
https://github.com/gmetais/sw-delta#why-does-sw-delta-use-indexeddb-instead-of-the-cache-api-in-its-service-worker

Maybe just referencing this issue to say it's a possible work-in-progress. Otherwise folks may get the wrong idea about how the Cache API works

@gmetais
Copy link
Owner

gmetais commented Aug 15, 2016

Maybe just referencing this issue to say it's a possible work-in-progress.

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants