CacheStorage

open class CacheStorage(source)

The CacheStorage interface represents the storage for Cache objects. Available only in secure contexts.

MDN Reference

Functions

Link copied to clipboard
inline suspend fun CacheStorage.delete(cacheName: String): Boolean

The delete() method of the CacheStorage interface finds the Cache object matching the cacheName, and if found, deletes the Cache object and returns a Promise that resolves to true. If no Cache object is found, it resolves to false.

Link copied to clipboard
external fun deleteAsync(cacheName: String): Promise<JsBoolean>

The delete() method of the CacheStorage interface finds the Cache object matching the cacheName, and if found, deletes the Cache object and returns a Promise that resolves to true. If no Cache object is found, it resolves to false.

Link copied to clipboard
inline suspend fun CacheStorage.has(cacheName: String): Boolean

The has() method of the CacheStorage interface returns a Promise that resolves to true if a Cache object matches the cacheName.

Link copied to clipboard
external fun hasAsync(cacheName: String): Promise<JsBoolean>

The has() method of the CacheStorage interface returns a Promise that resolves to true if a Cache object matches the cacheName.

Link copied to clipboard
inline suspend fun CacheStorage.keys(): ReadonlyArray<JsString>

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. Use this method to iterate over a list of all Cache objects.

Link copied to clipboard
external fun keysAsync(): Promise<ReadonlyArray<JsString>>

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. Use this method to iterate over a list of all Cache objects.

Link copied to clipboard
inline suspend fun CacheStorage.match(url: String): Response?
inline suspend fun CacheStorage.match(request: Request): Response?
inline suspend fun CacheStorage.match(url: URL): Response?
inline suspend fun CacheStorage.match(url: String, options: MultiCacheQueryOptions): Response?
inline suspend fun CacheStorage.match(request: Request, options: MultiCacheQueryOptions): Response?
inline suspend fun CacheStorage.match(url: URL, options: MultiCacheQueryOptions): Response?

The match() method of the CacheStorage interface checks if a given Request or URL string is a key for a stored Response. This method returns a Promise for a Response, or a Promise which resolves to undefined if no match is found.

Link copied to clipboard
external fun matchAsync(url: String, options: MultiCacheQueryOptions = definedExternally): Promise<Response?>
external fun matchAsync(request: Request, options: MultiCacheQueryOptions = definedExternally): Promise<Response?>
external fun matchAsync(url: URL, options: MultiCacheQueryOptions = definedExternally): Promise<Response?>

The match() method of the CacheStorage interface checks if a given Request or URL string is a key for a stored Response. This method returns a Promise for a Response, or a Promise which resolves to undefined if no match is found.

Link copied to clipboard
inline suspend fun CacheStorage.open(cacheName: String): Cache

The open() method of the CacheStorage interface returns a Promise that resolves to the Cache object matching the cacheName.

Link copied to clipboard
external fun openAsync(cacheName: String): Promise<Cache>

The open() method of the CacheStorage interface returns a Promise that resolves to the Cache object matching the cacheName.