Web APIs

CacheStorage.prototype.delete()

Try the free JavaScript compiler

Removes the named cache, resolving to whether it existed and was deleted.

Formal Syntax & Structure

javascript syntaxjavascript
caches.delete(cacheName)

Parameters & Attributes

NameTypeDescription
cacheNamestringName 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);}})()
JavaScript Reference