Simple LRU cache. put and get.
Suitable for use in browsers and Node.js.
$ npm install --save tiny-lru-cache
var LRUCache = require('tiny-lru-cache');
var maxSize = 100;
var cache = new LRUCache(maxSize);
cache.put('key', 'value');
cache.get('key'); // returns 'value'
cache.flush(); // Empties the cache
Once the cache reaches its maximum size, the least recently used (LRU) item is evicted.
npm install
npm test
MIT © Andy Hume