@stringsync/vexml
Version:
MusicXML to Vexflow
18 lines (17 loc) • 661 B
TypeScript
/**
* Represents a least-recently-used (LRU) cache.
*
* When at capacity, this cache will evict the least recently used key-value pair. This is particularly useful if you
* don't intend a cache to grow in size indefinitely.
*/
export declare class LRU<K, V> {
private capacity;
private map;
constructor(capacity: number);
/** Returns the value corresponding to the key, if it exists. Defaults to null. */
get(key: K): V | null;
/** Puts the key-value pair, updating how recently "used" a key was used if applicable. */
put(key: K, value: V): void;
/** Returns whether the key is in the cache. */
has(key: K): boolean;
}