lru2
lru2
Yet another LRU module with a very simple API. Just get/set and no more.
Motivation
I needed a super simple lru2
there were others having more methods than the ones I required.
Install
npm i -D lru2
Usage
// create the cachevar lru2 = ; // limit=0 for no limit // set an entrylru2; // get the valuelru2 // some value if present // get not existent keylru2 // will return null // get the current state of the cachelru2; // [ { key: 'key', value: { some : 'value' }}] // peek some value (without marking it as recently used)var entry = lru2; // undefined if key does not exists // removes the entry regardless if it is recently used or notlru2; //var lru2 = ;