(key: K, value: V)
| 25 | } |
| 26 | |
| 27 | set(key: K, value: V): void { |
| 28 | if (this.cache.has(key)) { |
| 29 | this.cache.delete(key); |
| 30 | } else if (this.cache.size >= this.maxSize) { |
| 31 | const firstKey = this.cache.keys().next().value; |
| 32 | if (firstKey !== undefined) { |
| 33 | this.cache.delete(firstKey); |
| 34 | } |
| 35 | } |
| 36 | this.cache.set(key, value); |
| 37 | } |
| 38 | |
| 39 | clear(): void { |
| 40 | this.cache.clear(); |
no outgoing calls
no test coverage detected