// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// deno-lint-ignore-file no-var
///
///
/** @category Cache */
declare var caches: CacheStorage;
/** @category Cache */
interface CacheStorage {
/** Open a cache storage for the provided name. */
open(cacheName: string): Promise;
/** Check if cache already exists for the provided name. */
has(cacheName: string): Promise;
/** Delete cache storage for the provided name. */
delete(cacheName: string): Promise;
}
/** @category Cache */
interface Cache {
/**
* 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`.
*/
put(request: RequestInfo | URL, response: Response): Promise;
/**
* 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`.
*/
match(
request: RequestInfo | URL,
options?: CacheQueryOptions,
): Promise;
/**
* 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`.
*/
delete(
request: RequestInfo | URL,
options?: CacheQueryOptions,
): Promise;
}
/** @category Cache */
declare var Cache: {
readonly prototype: Cache;
new (): never;
};
/** @category Cache */
declare var CacheStorage: {
readonly prototype: CacheStorage;
new (): never;
};
/** @category Cache */
interface CacheQueryOptions {
ignoreMethod?: boolean;
ignoreSearch?: boolean;
ignoreVary?: boolean;
}