src

1.1.2 • Public • Published

src

Simple Redis Cache Build Status

Usage

src takes one hash parameter with url and expiry defined. Expiry is the number of seconds a value is non expired in Redis.

var src = require('src');
var cache = src(
  {
    url:'redis://user:password@example.com:9073/'
    ,expiry:2
  }
);

Callbacks for set are optional

cache.set('key', 'value', [cb]);

get requires a callback

cache.get('key', function(err, value){
  if(typeof value !== 'undefined')
    console.log(value);
});

If the key has expired, err will not be used to determine this. Err will only be a non null value when an error is thrown from Redis.

If you want to delete a key from the cache explicity src provides this functionality through cache.del

Callbacks are optional for del

cache.del('key', [cb]);

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.2
    124,244
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.2
    124,244
  • 1.1.1
    10
  • 1.1.0
    8
  • 1.0.0
    206
  • 0.1.0
    6

Package Sidebar

Install

npm i src

Weekly Downloads

106,211

Version

1.1.2

License

MIT

Last publish

Collaborators

  • wlaurance