@anyplot/lru
v1.0.0
Published
Nano (~400 bytes) & O(1) performance LRU library.
Downloads
4
Readme
@AnyPlot/lru
🧩 Nano (~400 bytes) & O(1) performance LRU library.
Usage
import LRU from '@anyplot/lru';
const lru = new LRU(3);
lru.set('a', 1);
lru.set('b', 2);
lru.set('c', 3);
lru.size(); // 3
lru.get('a'); // 1
lru.get('b'); // 2
lru.set('d', 4);
lru.peer('a'); // 1
lru.peer('b'); // 2
lru.peer('c'); // undefined
lru.peer('d'); // 4
License
MIT@hustcc.