0.0.2 • Published 12 years ago

ttl-lru-cache v0.0.2

Weekly downloads
134
License
-
Repository
github
Last release
12 years ago

ttl-lru-cache - A fast in memory cache with TTL and LRU support

build status

Installation

  npm install ttl-lru-cache

Usage

var cache = require('ttl-lru-cache')({ maxLength: 100 });

cache.set('a', 'Hello');

var a = cache.get('a');

// a = 'Hello'

// TTL Example
cache.set('b', 'Hello', 1000); // Add TTL in ms
var b = cache.get('b');
// b = 'Hello'

setTimeout(function() {
  var b = cache.get('b');
// b = undefined
}, 2000);

Benchmark against lru-cache

  npm install
  make bench

Credits

Paul Serby follow me on twitter @serby

Licence

Licenced under the New BSD License

0.0.2

12 years ago

0.0.1

12 years ago