This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LruCache<T> { | |
private values: Map<string, T> = new Map<string, T>(); | |
private maxEntries: number = 20; | |
public get(key: string): T { | |
const hasKey = this.values.has(key); | |
let entry: T; | |
if (hasKey) { | |
// peek the entry, re-insert for LRU strategy |