lru-cache-pool

0.1.1 • Public • Published

LRU Cache Pool Build Status NPM version

A pool of LRU caches.

Usage

var LRU = require('lru-cache'),
  LRUPool = require('lru-cache-pool'),
  pool = LRUPool(LRU),
  c1, c2;
 
c1 = pool.get('users');
c1.put('z', 77);
 
c2 = pool.get('users');
assert.equal(77, c2.get('z'));

Options

Options can be provided in the constructor LRUPool(LRU, options), as well as when creating new caches via get pool.get('name', options).

Refer to the lru-cache Options section of the readme for details.

Note

When calling pool.get(), for the first time a new cache will be created and placed in a pool. Subsequent calls will get an existing cache from the pool, unless it is expired; in which case a new cache will be created.

License

MIT

Package Sidebar

Install

npm i lru-cache-pool

Weekly Downloads

1

Version

0.1.1

License

MIT

Last publish

Collaborators

  • ddrinf
  • nemtsov