lru-list

Storage-agnostic LRU list with async/multi-key operations

lru-list

Storage-agnostic LRU list with async/multi-key operations.

var list = require('lru-list').create()
 
list.setOption('limit', 50)
    .setOption('set', function(pairscb) {
      // Write to storage ... 
      cb(/* or Error() */);
    })
    .setOption('get', function(keyscb) {
      // Read from storage ... 
      cb(/* or Error() */, pairs);
    })
    .setOption('del', function(keyscb) {
      // Write to storage ... 
      cb(/* or Error() */);
    });
 
list.set(key, val, function setDone(err) { /* ... */ });
list.set(pairs, function setDone(err) { /* ... */ });
list.shift(function shiftDone(err) { /* ... */ });
list.get(keys, function getDone(errval) { /* ... */ });
list.del(keys, function delDone(err) { /* ... */ });

NPM

npm install lru-list

component

component install codeactual/lru-list

LRUList / LRUEntry

MIT

Based on https://github.com/rsms/js-lru (MIT).

npm test

Browser via Karma

  • npm install karma
  • karma start
  • Browse http://localhost:9876/
  • make build && karma run