Web APIs
CacheStorage.prototype.open()
Returns a promise for a named Cache, creating it if needed.
Formal Syntax & Structure
javascript syntaxjavascript
caches.open(cacheName)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| cacheName | string | Application-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);}})()