Read cleared cache data
P粉556159786
2023-08-09 16:15:34
<p>I have a module test: </p>
<pre class="brush:php;toolbar:false;">var myCache = await caches.open("test"); // Create a new cache
await myCache.add(new Request("/index.html")); // The page is successfully stored
await caches.delete("test");
myCache.match("/index.html"); // I can still read from the deleted cache! </pre>
<p>After deleting the cache, I can't see it in the browser inspector anymore, but I can still get the response via the <code>.match</code> method. Here I am expecting an error, please explain this unexpected behavior. </p>
There seems to be confusion about the description of CacheStorage.delete on the MDN website. Actually, the object is not deleted. The W3C specification specifies that cacheJobPromise will only delete the key in the map, not the object itself.