Web APIs
CacheStorage.prototype.delete()
Removes the named cache, resolving to whether it existed and was deleted.
Formal Syntax & Structure
javascript syntaxjavascript
caches.delete(cacheName)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| cacheName | string | Name of cache to remove. |
Return Value
Promise<boolean>
Removes the named cache, resolving to whether it existed and was deleted.
Working Example
Example Snippetjavascript
(async () => {const name="bm-v14-"+crypto.randomUUID();try{await caches.open(name);console.log(await caches.delete(name),(await caches.keys()).includes(name));}finally{await caches.delete(name);}})()