CacheStorage

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

MDN Reference

Functions

Link copied to clipboard
suspend fun 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.

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

The has() method of the CacheStorage interface returns a Promise that resolves to true if a You can access CacheStorage through the Window.caches property in windows or through the WorkerGlobalScope.caches property in workers.

Link copied to clipboard
fun hasAsync(cacheName: String): Promise<JsBoolean>
Link copied to clipboard
suspend fun 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.

Link copied to clipboard
Link copied to clipboard
suspend fun match(url: String, options: MultiCacheQueryOptions = definedExternally): Response?

The match() method of the CacheStorage interface checks if a given Request or URL string is a key for a stored Response.

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

The open() method of the the Cache object matching the cacheName.

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