1 | import { EventEmitter } from 'events';
|
2 |
|
3 | export class CacheEntry<T> extends EventEmitter {
|
4 | get(callback?: (err: Error, result: T) => void): T | undefined;
|
5 | set(value: T): void;
|
6 | clear(): void;
|
7 | }
|
8 |
|
9 | export class Cache {
|
10 | /**
|
11 | * Clear cache entries prefix matching given key
|
12 | * @param key Key prefix of cache entry to clear
|
13 | */
|
14 | clear(key?: string): void;
|
15 |
|
16 | /**
|
17 | * Retrieve cache entry, or create if not exists
|
18 | * @param key Key of cache entry
|
19 | */
|
20 | get<T>(key?: string): CacheEntry<T>;
|
21 | }
|