Simple LFU cache. put and get.
Suitable for use in browsers and Node.js.
$ npm install --save tiny-lfu-cachevar LFUCache = require('tiny-lfu-cache');
var maxSize = 100;
var cache = new LFUCache(maxSize);
cache.put('key', 'value');
cache.get('key'); // returns 'value'
cache.flush(); // Empties the cacheOnce the cache reaches its maximum size, the least frequently used (LFU) item is evicted.
If items in the cache have equal frequency of use, then the least recently used (LRU) item is evicted.
npm install
npm testMIT © Andy Hume