Redis.cacheValue()

Cache a value using the specified key.

If a `ttl` ("time-to-live") timeout is specified, the key will be deleted automatically after the specified number of seconds.

Usage

Hover over inputs/exits for more info.

var Redis = require('machinepack-redis');


// Cache a value using the specified key.

Redis.cacheValue({

connection: '===',

key: 'myNamespace.foo.bar_baz',

value: '*',

ttl: 86400,

meta: '===',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

: function () {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

connection required

An active Redis connection.

'==='
key required

The unique key under which this value should be stored.

'myNamespace.foo.bar_baz'
value required

The value to cache.

'*'
ttl

The number of seconds to store this value before automatically deleting it.

86400
meta

Additional metadata to pass to the driver.

'==='

Exits

error

An unexpected error occurred.

undefined
success

OK.

{ meta: '===' }