/** * @typedef {import('../types/types.js').CachedRequests} CachedRequests * @typedef {import('../types/types.js').CacheResponse} CacheResponse */ export default class Cache { /** * @type {CachedRequests} * @private */ private _cachedRequests; /** * @type {number} * @private */ private _size; /** * Store an item in the cache * @param {string} requestId key by which the request is stored * @param {CacheResponse} response the cached response * @param {number} size the response size */ set(requestId: string, response: CacheResponse, size?: number): void; /** * Retrieve an item from the cache * @param {string} requestId key by which the cache is stored * @param {object} options * @param {number} [options.maxAge] maximum age of a cached request to serve from cache, in milliseconds * @param {number} [options.maxResponseSize] maximum size of a cached request to serve from cache, in bytes * @returns {CacheResponse | undefined} */ get(requestId: string, { maxAge, maxResponseSize }?: { maxAge?: number | undefined; maxResponseSize?: number | undefined; }): CacheResponse | undefined; /** * Delete the item with the given requestId from the cache * @param {string } requestId the request id to delete from the cache */ delete(requestId: string): void; /** * Delete all items from the cache that match given regex * @param {RegExp} regex a regular expression to match cache entries */ deleteMatching(regex: RegExp): void; /** * Truncate the cache to the given size, according to a First-In-First-Out (FIFO) policy * * @param {number} maxAllowedCacheSize */ truncateTo(maxAllowedCacheSize: number): void; reset(): void; } export type CachedRequests = import('../types/types.js').CachedRequests; export type CacheResponse = import('../types/types.js').CacheResponse; //# sourceMappingURL=Cache.d.ts.map