/** * A generic Least Recently Used (LRU) cache with an optional eviction callback. * * Uses `Map` insertion order for O(1) LRU tracking: deleting and re-inserting * a key promotes it to the most-recently-used position. * * The `onEvict` callback is critical for resource cleanup (e.g. closing WebRTC * connections) and fixes the memory leak present in the v1 implementation. */ export declare class LRUCache { private readonly maxSize; private readonly onEvict?; private readonly cache; constructor(maxSize: number, onEvict?: (key: string, value: T) => void); /** Retrieve a value by key, promoting it to most-recently-used. */ get(key: string): T | undefined; /** Insert or update a value. Evicts the LRU entry if at capacity. */ set(key: string, value: T): void; /** Check whether a key exists in the cache (without promoting it). */ has(key: string): boolean; /** * Remove a key from the cache. Returns true if the key existed. * * Note: Unlike {@link clear}, this does NOT call the `onEvict` callback. * The caller is responsible for any cleanup of the removed value. */ delete(key: string): boolean; /** Remove all entries from the cache, calling onEvict for each. */ clear(): void; /** The number of entries currently in the cache. */ get size(): number; /** Iterate over all entries without promoting them (no LRU side-effects). */ forEach(callback: (value: T, key: string) => void): void; /** Evict the least recently used entry (first key in Map iteration order). */ private evictLRU; } //# sourceMappingURL=lru-cache.d.ts.map