MCPcopy
hub / github.com/trekhleb/javascript-algorithms / promote

Method promote

src/data-structures/lru-cache/LRUCache.js:80–83  ·  view source on GitHub ↗

* Promotes the node to the end of the linked list. * It means that the node is most frequently used. * It also reduces the chance for such node to get evicted from cache. * @param {LinkedListNode} node

(node)

Source from the content-addressed store, hash-verified

78 * @param {LinkedListNode} node
79 */
80 promote(node) {
81 this.evict(node);
82 this.append(node);
83 }
84
85 /**
86 * Appends a new node to the end of the cache linked list.

Callers 2

getMethod · 0.95
setMethod · 0.95

Calls 2

evictMethod · 0.95
appendMethod · 0.95

Tested by

no test coverage detected