Interface CacheStorage
delete(cacheName: string): Promise<boolean>;
has(cacheName: string): Promise<boolean>;
keys(): Promise<string[]>;
match(
request: URL | RequestInfo,
options?: MultiCacheQueryOptions,
): Promise<Response | undefined>;
open(cacheName: string): Promise<Cache>;
}
Methods
delete
The
delete()method of the CacheStorage interface finds the Cache object matching thecacheName, and if found, deletes the Cache object and returns a Promise that resolves totrue.Parameters
- cacheName: string
Returns Promise<boolean>
has
The
has()method of the CacheStorage interface returns a Promise that resolves totrueif a You can accessCacheStoragethrough the Window.caches property in windows or through the WorkerGlobalScope.caches property in workers.Parameters
- cacheName: string
Returns Promise<boolean>
keys
The
keys()method of the CacheStorage interface returns a Promise that will resolve with an array containing strings corresponding to all of the named Cache objects tracked by the CacheStorage object in the order they were created.Returns Promise<string[]>
match
- match(
request: URL | RequestInfo,
options?: MultiCacheQueryOptions,
): Promise<Response | undefined>The
match()method of the CacheStorage interface checks if a given Request or URL string is a key for a stored Response.Parameters
- request: URL | RequestInfo
Optionaloptions: MultiCacheQueryOptions
Returns Promise<Response | undefined>
open
The
open()method of the the Cache object matching thecacheName.Parameters
- cacheName: string
Returns Promise<Cache>
The
CacheStorageinterface represents the storage for Cache objects. Available only in secure contexts.MDN Reference