@anyplot/lru

Nano (~400 bytes) & O(1) performance LRU library.

Usage no npm install needed!

<script type="module">
  import anyplotLru from 'https://cdn.skypack.dev/@anyplot/lru';
</script>

README

@AnyPlot/lru

🧩 Nano (~400 bytes) & O(1) performance LRU library.

Build Status Coverage Status npm Version npm Download npm License

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.