forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lru-cache.d.ts
36 lines (32 loc) · 928 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
35
36
// Type definitions for lru-cache v4.0.1
// Project: https://github.com/isaacs/node-lru-cache
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'lru-cache' {
function LRU<T>(opts: LRU.Options<T>): LRU.Cache<T>;
function LRU<T>(max: number): LRU.Cache<T>;
namespace LRU {
interface Options<T> {
max?: number;
maxAge?: number;
length?: (value: T) => number;
dispose?: (key: any, value: T) => void;
stale?: boolean;
}
interface Cache<T> {
set(key: any, value: T, maxAge?: number): void;
get(key: any): T;
peek(key: any): T;
has(key: any): boolean
del(key: any): void;
reset(): void;
prune(): void;
forEach(iter: (value: T, key: any, cache: Cache<T>) => void, thisp?: any): void;
itemCount: number;
length: number
keys(): any[];
values(): T[];
}
}
export = LRU;
}