UNPKG

785 BTypeScriptView Raw
1/** A simple Least Recently Used map */
2export declare class LRUMap<K, V> {
3 private readonly _maxSize;
4 private readonly _cache;
5 constructor(_maxSize: number);
6 /** Get the current size of the cache */
7 get size(): number;
8 /** Get an entry or undefined if it was not in the cache. Re-inserts to update the recently used order */
9 get(key: K): V | undefined;
10 /** Insert an entry and evict an older entry if we've reached maxSize */
11 set(key: K, value: V): void;
12 /** Remove an entry and return the entry if it was in the cache */
13 remove(key: K): V | undefined;
14 /** Clear all entries */
15 clear(): void;
16 /** Get all the keys */
17 keys(): Array<K>;
18 /** Get all the values */
19 values(): Array<V>;
20}
21//# sourceMappingURL=lru.d.ts.map
\No newline at end of file