Web APIs

CacheStorage.prototype.open()

Try the free JavaScript compiler

Returns a promise for a named Cache, creating it if needed.

Formal Syntax & Structure

javascript syntaxjavascript
caches.open(cacheName)

Parameters & Attributes

NameTypeDescription
cacheNamestringApplication-specific cache name.

Return Value

Promise<Cache>

Returns a promise for a named Cache, creating it if needed.

Working Example

Example Snippetjavascript
(async () => {const name="bm-v14-"+crypto.randomUUID();try{const cache=await caches.open(name);console.log(typeof cache.match,(await caches.keys()).includes(name));}finally{await caches.delete(name);}})()
JavaScript Reference