(resetStats = true)
| 656 | } |
| 657 | |
| 658 | override clear(resetStats = true) { |
| 659 | const oldSize = this.#cacheKeyToEntryMap.size; |
| 660 | this.#cacheKeyToEntryMap.clear(); |
| 661 | this.#keyToCacheKeySetMap.clear(); |
| 662 | |
| 663 | if (resetStats) { |
| 664 | if (!(this.#statsCounter instanceof DisabledStatsCounter)) { |
| 665 | this.#statsCounter = DefaultStatsCounter.create(); |
| 666 | } |
| 667 | } else { |
| 668 | // If old entries were evicted due to clear, record them as evictions |
| 669 | if (oldSize > 0) { |
| 670 | this.#statsCounter.recordEvictions(oldSize); |
| 671 | } |
| 672 | } |
| 673 | } |
| 674 | |
| 675 | get(cacheKey: string) { |
| 676 | const val = this.#cacheKeyToEntryMap.get(cacheKey); |
no test coverage detected