1 |
|
2 | export declare class LruCache<T, U> {
|
3 | protected _map: Map<T, U>;
|
4 | protected _maxSize: number;
|
5 | constructor(options?: LruCache.IOptions);
|
6 | /**
|
7 | * Return the current size of the cache.
|
8 | */
|
9 | get size(): number;
|
10 | /**
|
11 | * Clear the values in the cache.
|
12 | */
|
13 | clear(): void;
|
14 | /**
|
15 | * Get a value (or null) from the cache, pushing the item to the front of the cache.
|
16 | */
|
17 | get(key: T): U | null;
|
18 | /**
|
19 | * Set a value in the cache, potentially evicting an old item.
|
20 | */
|
21 | set(key: T, value: U): void;
|
22 | }
|
23 | export declare namespace LruCache {
|
24 | interface IOptions {
|
25 | maxSize?: number | null;
|
26 | }
|
27 | }
|