romis
node_redis but with promises. This
exposes the exact same API as node_redis
, but all the redis commands don't
take callbacks and instead return promises.
Installation
Usage
var romis = var Promise = ;var client = romis;var log = consolelog;var error = consoleerror; // Execute all promisesPromiseall client client client client // Log resulting keys; // Catch any errors that occured in the chain
node_redis
to Promises
Transitioning from To help you move from node_redis
callbacks to romis
Promises, both romis
and node_redis
work well in parallel. You can keep your existing code base unchanged and write new code using Promises.
romis.fromRedis
Using Keep your legacy code and re-use your exisitng client instance with the fromRedis
function.
// keep your legacy code unchangedvar redis = ;var client= redis; client; // re-use the redis client with romis.fromRedisvar romis = ;var romisClient = romis;romisClient // handle error
_redis
property
Using the The object returned by romis' createClient
or fromRedis
exposes the original node-redis
object in a property called _redis
. You can access this property should you need to use traditional, callback-based functions for backwards compatibility.
var romis = var romisClient = romis; // call an old-style, callback-based methodromisClient_redis;