Skip to main content

interface CacheStorage

Represents the storage for named Cache objects. It provides the methods used to open, enumerate, look up, and delete caches, and is accessed via the global caches property.

Methods #

#open(cacheName: string): Promise<Cache>

Open a cache storage for the provided name.

#has(cacheName: string): Promise<boolean>

Check if cache already exists for the provided name.

#delete(cacheName: string): Promise<boolean>

Delete cache storage for the provided name.

#keys(): Promise<string[]>

Return an array of all cache names tracked by the cache storage.

#match(
request: RequestInfo | URL,
): Promise<Response | undefined>

Check if a given Request or URL string is a key for a stored Response. Returns the matching Response, or undefined if no match is found.

If options.cacheName is provided, only the cache with that name is searched. Otherwise, all caches are searched in creation order.

variable CacheStorage

The constructor object for CacheStorage.

The CacheStorage instance is accessed via the global caches property rather than constructed directly, so calling the constructor throws.

Properties #

Did you find what you needed?

Privacy policy