docs.rodeo

MDN Web Docs mirror

Cache: delete() method

{{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.

Syntax

delete(request)
delete(request, options)

Parameters

Return value

a {{jsxref("Promise")}}  that resolves to true if the cache entry is deleted, or false otherwise.

Examples

caches.open("v1").then((cache) => {
  cache.delete("/images/image.png").then((response) => {
    someUIUpdateFunction();
  });
});

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN