Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Cache Interfaces #12

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,35 @@ interface Request {
}
}

interface CacheOptions {
/**
* Consider the request method a GET regardless of its actual value.
*/
ignoreMethod?: boolean;
}

export interface Caches {
default: {
/**
* Adds to the cache a response keyed to the given request.
* Returns a promise that resolves to undefined once the cache stores the response.
*/
put(request: Request | string, response: Response): Promise<undefined>;
/**
* Returns a promise wrapping the response object keyed to that request.
*/
match(request: Request | string, options?: CacheOptions): Promise<Response | undefined>;
/**
* Deletes the Response object from the cache and
* returns a Promise for a Boolean response
*/
delete(request: Request | string, options?: CacheOptions): Promise<boolean>;
};
}

declare let caches: Caches;


interface ContentOptions {
/**
* Controls the way the HTMLRewriter treats inserted content.
Expand Down