Cache

sealed external class Cache(source)

Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. Available only in secure contexts.

MDN Reference

Functions

Link copied to clipboard
suspend fun add(request: String)
suspend fun add(request: URL)

suspend fun add(request: Request)
Link copied to clipboard
suspend fun addAll(requests: ReadonlyArray<String>)

suspend fun addAll(requests: ReadonlyArray<Request>)
Link copied to clipboard
Link copied to clipboard
fun addAsync(request: String): Promise<Void>
fun addAsync(request: Request): Promise<Void>
fun addAsync(request: URL): Promise<Void>
Link copied to clipboard
suspend fun delete(request: String, options: CacheQueryOptions = definedExternally): Boolean
suspend fun delete(request: URL, options: CacheQueryOptions = definedExternally): Boolean

suspend fun delete(request: Request, options: CacheQueryOptions = definedExternally): Boolean
Link copied to clipboard
fun deleteAsync(request: String, options: CacheQueryOptions = definedExternally): Promise<Boolean>
fun deleteAsync(request: Request, options: CacheQueryOptions = definedExternally): Promise<Boolean>
fun deleteAsync(request: URL, options: CacheQueryOptions = definedExternally): Promise<Boolean>
Link copied to clipboard
suspend fun keys(request: String, options: CacheQueryOptions = definedExternally): ReadonlyArray<Request>
suspend fun keys(request: URL, options: CacheQueryOptions = definedExternally): ReadonlyArray<Request>

suspend fun keys(request: Request = definedExternally, options: CacheQueryOptions = definedExternally): ReadonlyArray<Request>
Link copied to clipboard
fun keysAsync(request: String, options: CacheQueryOptions = definedExternally): Promise<ReadonlyArray<Request>>
fun keysAsync(request: Request = definedExternally, options: CacheQueryOptions = definedExternally): Promise<ReadonlyArray<Request>>
fun keysAsync(request: URL, options: CacheQueryOptions = definedExternally): Promise<ReadonlyArray<Request>>
Link copied to clipboard
suspend fun match(request: String, options: CacheQueryOptions = definedExternally): Response?
suspend fun match(request: URL, options: CacheQueryOptions = definedExternally): Response?

suspend fun match(request: Request, options: CacheQueryOptions = definedExternally): Response?
Link copied to clipboard
suspend fun matchAll(request: String, options: CacheQueryOptions = definedExternally): ReadonlyArray<Response>
suspend fun matchAll(request: URL, options: CacheQueryOptions = definedExternally): ReadonlyArray<Response>

suspend fun matchAll(request: Request = definedExternally, options: CacheQueryOptions = definedExternally): ReadonlyArray<Response>
Link copied to clipboard
fun matchAllAsync(request: String, options: CacheQueryOptions = definedExternally): Promise<ReadonlyArray<Response>>
fun matchAllAsync(request: Request = definedExternally, options: CacheQueryOptions = definedExternally): Promise<ReadonlyArray<Response>>
fun matchAllAsync(request: URL, options: CacheQueryOptions = definedExternally): Promise<ReadonlyArray<Response>>
Link copied to clipboard
fun matchAsync(request: String, options: CacheQueryOptions = definedExternally): Promise<Response?>
fun matchAsync(request: Request, options: CacheQueryOptions = definedExternally): Promise<Response?>
fun matchAsync(request: URL, options: CacheQueryOptions = definedExternally): Promise<Response?>
Link copied to clipboard
suspend fun put(request: String, response: Response)
suspend fun put(request: URL, response: Response)

suspend fun put(request: Request, response: Response)
Link copied to clipboard
fun putAsync(request: String, response: Response): Promise<Void>
fun putAsync(request: Request, response: Response): Promise<Void>
fun putAsync(request: URL, response: Response): Promise<Void>