MCPcopy
hub / github.com/TheAlgorithms/JavaScript / set

Method set

Cache/LRUCache.js:76–84  ·  view source on GitHub ↗

* @param {string} key * @param {*} value

(key, value)

Source from the content-addressed store, hash-verified

74 * @param {*} value
75 */
76 set(key, value) {
77 key = String(key)
78 // Sets the value for the input key and if the key exists it updates the existing key
79 if (this.size === this.capacity) {
80 this.#removeLeastRecentlyUsed()
81 }
82
83 this.cache.set(key, value)
84 }
85
86 /**
87 * @param {string} key

Callers 15

parseMethod · 0.95
getMethod · 0.45
memoizeFunction · 0.45
LFUCache.test.jsFile · 0.45
fibonacciCacheFunction · 0.45
LRUCache.test.jsFile · 0.45
constructorMethod · 0.45
dfsDepthMethod · 0.45
addNodeMethod · 0.45
dfsMethod · 0.45
padEndFunction · 0.45
caesarCipherFunction · 0.45

Calls 1

Tested by

no test coverage detected