Package-level declarations

Types

Link copied to clipboard
class Cache

The Cache interface provides a persistent storage mechanism for Request / Response object pairs that are cached in long lived memory. Available only in secure contexts.

Link copied to clipboard
Link copied to clipboard

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

Link copied to clipboard

Properties

Link copied to clipboard
external val caches: CacheStorage

Available only in secure contexts.

Functions

Link copied to clipboard
inline suspend fun Cache.add(url: String)

The add() method of the Cache interface takes a URL, retrieves it, and adds the resulting response object to the given cache.

inline suspend fun Cache.add(request: Request)
inline suspend fun Cache.add(url: URL)
Link copied to clipboard
inline suspend fun Cache.addAll(urls: ReadonlyArray<JsString>)

inline suspend fun Cache.addAll(requests: ReadonlyArray<Request>)

The addAll() method of the Cache interface takes an array of URLs, retrieves them, and adds the resulting response objects to the given cache.

Link copied to clipboard
inline suspend fun Cache.delete(url: String): Boolean
inline suspend fun Cache.delete(url: String, options: CacheQueryOptions): Boolean

The delete() method of the Cache interface finds the Cache entry whose key is the request, and if found, deletes the Cache entry and returns a Promise that resolves to true.

inline suspend fun Cache.delete(request: Request): Boolean
inline suspend fun Cache.delete(url: URL): Boolean
inline suspend fun Cache.delete(request: Request, options: CacheQueryOptions): Boolean
inline suspend fun Cache.delete(url: URL, options: CacheQueryOptions): Boolean

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.

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 You can access CacheStorage through the Window.caches property in windows or through the WorkerGlobalScope.caches property in workers.

Link copied to clipboard
inline suspend fun Cache.keys(): ReadonlyArray<Request>
inline suspend fun Cache.keys(url: String): ReadonlyArray<Request>
inline suspend fun Cache.keys(url: String, options: CacheQueryOptions): ReadonlyArray<Request>

The keys() method of the Cache interface returns a representing the keys of the Cache.

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.

inline suspend fun Cache.keys(request: Request): ReadonlyArray<Request>
inline suspend fun Cache.keys(url: URL): ReadonlyArray<Request>
inline suspend fun Cache.keys(request: Request, options: CacheQueryOptions): ReadonlyArray<Request>
inline suspend fun Cache.keys(url: URL, options: CacheQueryOptions): ReadonlyArray<Request>
Link copied to clipboard
inline suspend fun Cache.match(url: String): Response?
inline suspend fun Cache.match(url: String, options: CacheQueryOptions): Response?

The match() method of the Cache interface returns a Promise that resolves to the Response associated with the first matching request in the Cache object.

inline suspend fun Cache.match(request: Request): Response?
inline suspend fun Cache.match(url: URL): Response?
inline suspend fun CacheStorage.match(request: Request): Response?
inline suspend fun CacheStorage.match(url: URL): Response?
inline suspend fun Cache.match(request: Request, options: CacheQueryOptions): Response?
inline suspend fun Cache.match(url: URL, options: CacheQueryOptions): Response?
inline suspend fun CacheStorage.match(request: Request, options: MultiCacheQueryOptions): Response?
inline suspend fun CacheStorage.match(url: URL, options: MultiCacheQueryOptions): Response?

inline suspend fun CacheStorage.match(url: String): Response?
inline suspend fun CacheStorage.match(url: String, 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.

Link copied to clipboard
inline suspend fun Cache.matchAll(): ReadonlyArray<Response>
inline suspend fun Cache.matchAll(url: String): ReadonlyArray<Response>
inline suspend fun Cache.matchAll(url: String, options: CacheQueryOptions): ReadonlyArray<Response>

The matchAll() method of the Cache interface returns a Promise that resolves to an array of all matching responses in the Cache object.

inline suspend fun Cache.matchAll(request: Request): ReadonlyArray<Response>
inline suspend fun Cache.matchAll(url: URL): ReadonlyArray<Response>
inline suspend fun Cache.matchAll(request: Request, options: CacheQueryOptions): ReadonlyArray<Response>
inline suspend fun Cache.matchAll(url: URL, options: CacheQueryOptions): ReadonlyArray<Response>
Link copied to clipboard
inline suspend fun CacheStorage.open(cacheName: String): Cache

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

Link copied to clipboard
inline suspend fun Cache.put(url: String, response: Response)

The put() method of the Often, you will just want to Window/fetch one or more requests, then add the result straight to your cache.

inline suspend fun Cache.put(request: Request, response: Response)
inline suspend fun Cache.put(url: URL, response: Response)