Skip to main content

interface Cache

Represents a single named store of Request/Response pairs. Obtain a Cache via CacheStorage.open and use it to persist responses and later match incoming requests against them.

Methods #

#put(
request: RequestInfo | URL,
response: Response,
): Promise<void>

Put the provided request/response into the cache.

How is the API different from browsers?

  1. You cannot match cache objects using by relative paths.
  2. You cannot pass options like ignoreVary, ignoreMethod, ignoreSearch.
#match(
request: RequestInfo | URL,
): Promise<Response | undefined>

Return cache object matching the provided request.

How is the API different from browsers?

  1. You cannot match cache objects using by relative paths.
  2. You cannot pass options like ignoreVary, ignoreMethod, ignoreSearch.
#delete(
request: RequestInfo | URL,
): Promise<boolean>

Delete cache object matching the provided request.

How is the API different from browsers?

  1. You cannot delete cache objects using by relative paths.
  2. You cannot pass options like ignoreVary, ignoreMethod, ignoreSearch.

variable Cache

The constructor object for Cache.

Cache instances are obtained via CacheStorage.open rather than constructed directly, so calling the constructor throws.

Properties #

#prototype: Cache
readonly

Did you find what you needed?

Privacy policy