A Map of limited size that keeps most recently used values.
This lib is one of the several possible cache for memoize-immutable,
but it can suit other use-cases as it implements a usual Map API.
This lib has no dependency, but requires a native implementation of Map.
Install
npm install --save LRUMap
This lib has no dependency, but requires a native implementation of Map.
Usage
var LRUMap = require('LRUMap');
// The default size limit of the map is 10.000
var cache = new LRUMap({ limit: 10000 });
var key = 'Carole';
var value = {any: 'thing'};
cache.set(key, value);
cache.has(key) === true;
cache.get(key) === value;