UNPKG

@phensley/cldr-utils

Version:
25 lines (24 loc) 636 B
export declare type Key = string | number; declare type Node<V> = { key: Key; val: V; next?: Node<V>; prev?: Node<V>; }; /** * Cache evicts the least-recently-used key when capacity is exceeded. */ export declare class LRU<V> { private readonly storage; private readonly root; private readonly capacity; constructor(capacity?: number); size(): number; get(key: Key): V | undefined; set(key: Key, val: V): void; toString(): string; protected moveFront(n: Node<V>): void; protected insert(e: Node<V>, at: Node<V>): Node<V>; protected remove(n: Node<V>): Node<V>; } export {};