import { CacheEventEmitter } from './CacheEventEmitter.js'; import type { CacheEventType, CacheEventListener, CacheNode, CacheSnapshot, Key, Options, IsKeyEqual } from './internalTypes.js'; export declare class Cache any> { /** * The current [c]ount of entries in the cache. */ c: number; /** * Whether the entire key is [e]qual to an existing key in cache. */ e: IsKeyEqual; /** * The [h]ead of the cache linked list. */ h: CacheNode | undefined; /** * The transformer for the [k]ey stored in cache. */ k: Options['transformKey'] | undefined; /** * Event emitter for `[o]`n events. */ o: CacheEventEmitter | undefined; /** * Whether to await the [p]romise returned by the function. */ p: Options['async']; /** * The maximum [s]ize of the cache. */ s: number; /** * The [t]ail of the cache linked list. */ t: CacheNode | undefined; constructor(options: Options); /** * The size of the populated cache. */ get size(): number; /** * The [key, value] pairs for the existing entries in cache. */ get snapshot(): CacheSnapshot; /** * Clear the cache. */ clear(reason?: string): void; /** * Delete the entry for the key based on the given `args` in cache. */ delete(args: Parameters, reason?: string): boolean; /** * Get the value in cache based on the given `args`. */ get(args: Parameters, reason?: string): ReturnType | undefined; /** * Determine whether the given `args` have a related entry in the cache. */ has(args: Parameters): boolean; /** * Remove the given `listener` for the given `type` of cache event. */ off(type: Type, listener: CacheEventListener): void; /** * Add the given `listener` for the given `type` of cache event. */ on(type: Type, listener: CacheEventListener): void; /** * Add or update the cache entry for the given `key`. */ set(key: Parameters, value: ReturnType, reason?: string): void; /** * Method to [d]elete the given `node` from the cache. */ d(node: CacheNode, reason: string): void; /** * Method to [g]et an existing node from cache based on the given `key`. */ g(key: Key): CacheNode | undefined; /** * Method to create a new [n]ode and set it at the head of the linked list. */ n(key: Key, value: ReturnType, reason?: string): CacheNode; /** * Method to [u]date the location of the given `node` in cache. */ u(node: CacheNode, reason: string | undefined, hit: boolean): void; /** * Method to [w]rap the promise in a handler to automatically delete the * entry if it rejects. */ w(node: CacheNode): ReturnType; }