Open
Description
The implementation of this LRU cache does not enforce the documented behavior:
maxSize
Required
Type: number
The maximum number of items before evicting the least recently used items.
Running this code snippet produces true
in the console:
const m = new QuickLRU({
maxSize: 2
});
m.set("key1", "value1");
m.set("key2", "value2");
m.set("key3", "value3");
console.log(m.has("key1"));
The cache should only be able to store 2 items and when adding a total of 3 items to the list, the first key-value pair (key1
-value1
) should be evicted. However, from the result of executing the code, you can see that key1
is still in the cache.
Metadata
Metadata
Assignees
Labels
No labels
Activity