Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Storage-agnostic LRU list with async/multi-key operations
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
dist
docs
lib/lru-list
test/lib/lru-list
.gitignore
.travis.yml
CHANGELOG.md
Gruntfile.js
LICENSE
README.md
component.json
index.js
karma.conf.js
package.json

README.md

lru-list

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

Build Status

Example

var list = require('lru-list').create()

list.setOption('limit', 50)
    .setOption('set', function(pairs, cb) {
      // Write to storage ...
      cb(/* or Error() */);
    })
    .setOption('get', function(keys, cb) {
      // Read from storage ...
      cb(/* or Error() */, pairs);
    })
    .setOption('del', function(keys, cb) {
      // 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(err, val) { /* ... */ });
list.del(keys, function delDone(err) { /* ... */ });

See bindle for an example of using lru-list to handle QUOTA_EXCEEDED_ERR errors from localStorage.

Installation

NPM

npm install lru-list

component

component install codeactual/lru-list

API

Documentation

License

MIT

Based on js-lru (MIT).

Tests

Node

npm test

Browser via Karma

  • npm install karma
  • karma start
  • Browse http://localhost:9876/
  • make build && karma run
Something went wrong with that request. Please try again.