You can "modify" entries in the cache api
jakearchibald opened this issue · comments
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.
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!
You could put metadata in headers, but it could be that indexeddb is a better fit.
I like the idea of storing the info inside the headers. A unique request to Cache is better than 2 requests to Cache + IDB.
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
Maybe just referencing this issue to say it's a possible work-in-progress.
Done.