clache
Author
Evan Lucas
License
MIT
Installation
$ npm install --save clache
Tests
$ npm test
Coverage
$ npm run cover
API
clache()
Contructor
Example
var opts = {
ttl: 100
, host: '127.0.0.1'
, port: 6379
, password: null
}
var cache = new clache(opts)
Params
Name | Type(s) | Description |
---|
opts | Object | The options object |
clache.wrap()
Wrap an asynchronous function and cache it
Params
Name | Type(s) | Description |
---|
key | String | The key |
work | Function | The work function |
cb | Function | function(err, res) |
clache.set()
Set val for the given key
Params
Name | Type(s) | Description |
---|
key | String | The key |
val | String, Number, Boolean, Array, Object | The value |
cb | Function | function(err, res) |
clache.get()
Get the value for the given key
Params
Name | Type(s) | Description |
---|
key | String | The key |
cb | Function | function(err, res) |
clache.del()
Deletes the value for the given key
Params
Name | Type(s) | Description |
---|
key | String | The key |
cb | Function | function(err, res) |