Skip to content

dowjones/lru-cache-pool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published