tiny-lru-cache

1.0.1 • Public • Published

NPM version Build Status Dependency Status

Simple LRU cache. put and get.

Suitable for use in browsers and Node.js.

Install

$ npm install --save tiny-lru-cache

Usage

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

LRU Eviction Policy

Once the cache reaches its maximum size, the least recently used (LRU) item is evicted.

Development

npm install
npm test

License

MIT © Andy Hume

Package Sidebar

Install

npm i tiny-lru-cache

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • ahume