MCPcopy
hub / github.com/redis/node-redis / clear

Method clear

packages/client/lib/client/cache.ts:658–673  ·  view source on GitHub ↗
(resetStats = true)

Source from the content-addressed store, hash-verified

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);

Callers 10

invalidateMethod · 0.95
onErrorMethod · 0.95
onCloseMethod · 0.95
onPoolCloseFunction · 0.45
onErrorMethod · 0.45
onCloseMethod · 0.45
cache.spec.tsFile · 0.45
unsubscribeMethod · 0.45
cleanupMethod · 0.45
CLEAR.spec.tsFile · 0.45

Calls 2

recordEvictionsMethod · 0.65
createMethod · 0.45

Tested by

no test coverage detected