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