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 // in seconds host: '127.0.0.1' port: 6379 password: nullvar cache = opts
Params
Name | Type(s) | Description |
---|---|---|
opts | Object | The options object |
clache.wrap()
Wrap an asynchronous function and cache it
Example
{ return } var id = '1234'clache
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.setex()
Set val for the given key with ttl
Params
Name | Type(s) | Description |
---|---|---|
key | String | The key |
ttl | Number | The ttl |
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) |