files/en-us/web/api/cache/delete/index.md
{{APIRef("Service Workers API")}}{{SecureContext_Header}}{{AvailableInWorkers}}
The delete() method of the {{domxref("Cache")}} interface finds the {{domxref("Cache")}} entry whose key is the request, and if found, deletes the {{domxref("Cache")}} entry and returns a {{jsxref("Promise")}} that resolves to true.
If no {{domxref("Cache")}} entry is found, it resolves to false.
delete(request)
delete(request, options)
request
Request object or a URL.options {{optional_inline}}
delete operation.
The available options are:
ignoreSearch
true, the ?value=bar part of https://example.com/?value=bar would be ignored when performing a match.
It defaults to false.ignoreMethod
true, prevents matching operations from validating the
{{domxref("Request")}} HTTP method (normally only GET
and HEAD are allowed.) It defaults to false.ignoreVary
true, tells the matching operation not to perform VARY
header matching. In other words, if the URL matches you will get a match
regardless of whether the {{domxref("Response")}} object has a VARY
header. It defaults to false.cacheName
Cache.delete().A {{jsxref("Promise")}} that resolves to true if the cache entry is
deleted, or false otherwise.
caches
.open("v1")
.then((cache) => cache.delete("/images/image.png"))
.then((response) => {
someUIUpdateFunction();
});
{{Specifications}}
{{Compat}}