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

Method get

packages/client/lib/client/cache.ts:675–694  ·  view source on GitHub ↗
(cacheKey: string)

Source from the content-addressed store, hash-verified

673 }
674
675 get(cacheKey: string) {
676 const val = this.#cacheKeyToEntryMap.get(cacheKey);
677
678 if (val && !val.validate()) {
679 this.delete(cacheKey);
680 this.#statsCounter.recordEvictions(1);
681 // Entry failed validation - this is TTL expiry since invalidation marks are handled separately
682 publish(CHANNELS.CACHE_EVICTION, () => ({ reason: 'ttl', count: 1 }));
683 this.emit("cache-evict", cacheKey);
684
685 return undefined;
686 }
687
688 if (val !== undefined && this.lru) {
689 this.#cacheKeyToEntryMap.delete(cacheKey);
690 this.#cacheKeyToEntryMap.set(cacheKey, val);
691 }
692
693 return val;
694 }
695
696 delete(cacheKey: string) {
697 const entry = this.#cacheKeyToEntryMap.get(cacheKey);

Callers 15

handleCacheMethod · 0.95
getFunction · 0.45
invalidateMethod · 0.45
deleteMethod · 0.45
setMethod · 0.45
deleteOldestMethod · 0.45
getFunction · 0.45
factoryMethod · 0.45
#parseUnixURLMethod · 0.45
cache.spec.tsFile · 0.45
key-prefix.spec.tsFile · 0.45

Calls 5

deleteMethod · 0.95
publishFunction · 0.90
validateMethod · 0.65
recordEvictionsMethod · 0.65
setMethod · 0.45

Tested by 4

listenerFunction · 0.36
timedGetFunction · 0.36
getFunction · 0.36
runClientOperationsFunction · 0.36