forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lru-cache.d.ts
34 lines (29 loc) · 871 Bytes
/
lru-cache.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Type definitions for lru-cache v2.5.0
// Project: https://github.com/isaacs/node-lru-cache
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module 'lru-cache' {
function LRU<T>(opts: LRU.Options<T>): LRU.Cache<T>;
function LRU<T>(max: number): LRU.Cache<T>;
module LRU {
interface Options<T> {
max?: number;
maxAge?: number;
length?: (value: T) => number;
dispose?: (key: string, value: T) => void;
stale?: boolean;
}
interface Cache<T> {
set(key: string, value: T): void;
get(key: string): T;
peek(key: string): T;
has(key: string): boolean
del(key: string): void;
reset(): void;
forEach(iter: (value: T, key: string, cache: Cache<T>) => void, thisp?: any): void;
keys(): string[];
values(): T[];
}
}
export = LRU;
}