-
-
Notifications
You must be signed in to change notification settings - Fork 92
/
lru-cache.d.ts
43 lines (37 loc) · 1.17 KB
/
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
37
38
39
40
41
42
43
/**
* Mnemonist LRUCache Typings
* ===========================
*/
import {IArrayLikeConstructor} from './utils/types';
export default class LRUCache<K, V> implements Iterable<[K, V]> {
// Members
capacity: number;
size: number;
// Constructor
constructor(capacity: number);
constructor(KeyArrayClass: IArrayLikeConstructor, ValueArrayClass: IArrayLikeConstructor, capacity: number);
// Methods
clear(): void;
set(key: K, value: V): this;
setpop(key: K, value: V): {evicted: boolean, key: K, value: V};
get(key: K): V | undefined;
peek(key: K): V | undefined;
has(key: K): boolean;
forEach(callback: (value: V, key: K, cache: this) => void, scope?: any): void;
keys(): IterableIterator<K>;
values(): IterableIterator<V>;
entries(): IterableIterator<[K, V]>;
[Symbol.iterator](): IterableIterator<[K, V]>;
inspect(): any;
// Statics
static from<I, J>(
iterable: Iterable<[I, J]> | {[key: string]: J},
KeyArrayClass: IArrayLikeConstructor,
ValueArrayClass: IArrayLikeConstructor,
capacity?: number
): LRUCache<I, J>;
static from<I, J>(
iterable: Iterable<[I, J]> | {[key: string]: J},
capacity?: number
): LRUCache<I, J>;
}