"Least Recently Used" (LRU) cache compatible to ES6 Map
npm install map-lru> "Least Recently Used" (LRU) cache compatible to ES6 Map



Useful for caching with limited memory usage.
API compatible with built-in [Map][] object.
```
$ npm install map-lru
`js
import MapLRU from 'map-lru' // ES5
// const MapLRU = require('map-lru') // commonJs
const cache = new MapLRU(10)
cache.set('♥', '♥♥♥')
cache.has('♥');
//=> true
cache.get('♥');
//=> '♥♥♥'
cache.last
//=> '♥'
cache.size
//=> 1
`
Creates a new instance
Parameters
- maxSize Number max. size of the LRU cache.
----
_Additional methods_
- last
Returns the last accessed key.
Returns Any
- peek(key)
Get an item without marking it as recently used.
Parameters
- key Any
- keysAccessed()
keys in order of access - last one is most recently used one.
Returns Iterator Iterator object
----
_Default [Map][] methods_
- size
- get(key)
- has(key)
- clear()
- keys()
- values()
- [[Symbol.iterator]`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/@@iterator)
[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map