MCPcopy Index your code
hub / github.com/TheAlgorithms/JavaScript / #removeCacheNode

Method #removeCacheNode

Cache/LFUCache.js:124–131  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

122 }
123
124 #removeCacheNode() {
125 const leastFreqSet = this.#frequencyMap.get(this.leastFrequency)
126 // Select the least recently used node from the least Frequency set
127 const LFUNode = leastFreqSet.values().next().value
128
129 leastFreqSet.delete(LFUNode)
130 this.cache.delete(LFUNode.key)
131 }
132
133 /**
134 * if key exist then return true otherwise false

Callers 2

capacityMethod · 0.95
setMethod · 0.95

Calls 2

getMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected