UNPKG

644 BTypeScriptView Raw
1import { SimpleCache } from "./SimpleCache";
2/**
3 * Simple Map-based cache.
4 * Based on https://medium.com/spektrakel-blog/a-simple-lru-cache-in-typescript-cba0d9807c40
5 */
6export declare class LruCache<T> implements SimpleCache<T> {
7 private readonly maxEntries;
8 private readonly evictCallback;
9 private gets;
10 private hits;
11 private readonly values;
12 constructor(maxEntries?: number, evictCallback?: (t: T) => void);
13 get stats(): {
14 hits: number;
15 gets: number;
16 };
17 get(key: string): T;
18 put(key: string, value: T): void;
19 evict(key: string): boolean;
20}
21//# sourceMappingURL=LruCache.d.ts.map
\No newline at end of file