lrumap

1.0.0 • Public • Published

TupleMap npm version Build Status Dependency Status Coverage Status

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.

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;

When should you use this map?

This map should be used as an alternative to a native Map, when you need to limit its size.

Author

@louis_remi

License

MPL-2.0

Readme

Keywords

Package Sidebar

Install

npm i lrumap

Weekly Downloads

1,239

Version

1.0.0

License

MPL-2.0

Last publish

Collaborators

  • louisremi