()
| 150 | } |
| 151 | |
| 152 | #pruneToMaxSize(): void { |
| 153 | if (this.size <= this.#maxSize) return; |
| 154 | const key = this.keys().next().value!; |
| 155 | const value = super.get(key)!; |
| 156 | super.delete(key); |
| 157 | if (this.#eject) { |
| 158 | this.#ejecting = true; |
| 159 | try { |
| 160 | this.#eject(key, value, "evicted"); |
| 161 | } finally { |
| 162 | this.#ejecting = false; |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * Checks whether an element with the specified key exists or not. Does |