()
| 64 | } |
| 65 | |
| 66 | private evictOldest(): void { |
| 67 | const first = this.cache.keys().next(); |
| 68 | if (!first.done) { |
| 69 | const entry = this.cache.get(first.value); |
| 70 | if (entry) this.totalBytes -= entry.size; |
| 71 | this.cache.delete(first.value); |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | reset(): void { |
| 76 | this.cache.clear(); |