MCPcopy Index your code
hub / github.com/TheAlgorithms/JavaScript / refresh

Method refresh

Cache/LFUCache.js:25–33  ·  view source on GitHub ↗

* @method refresh * @description - It's revive a CacheNode, increment of this nodes frequency and refresh the frequencyMap via new incremented nodes frequency * @param {CacheNode} node

(node)

Source from the content-addressed store, hash-verified

23 * @param {CacheNode} node
24 */
25 refresh(node) {
26 const { frequency } = node
27 const freqSet = this.get(frequency)
28 freqSet.delete(node)
29
30 node.frequency++
31
32 this.insert(node)
33 }
34
35 /**
36 * @method insert

Callers 2

getMethod · 0.80
setMethod · 0.80

Calls 3

insertMethod · 0.95
getMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected