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.
To help you move from node_redis callbacks to romisPromises, both romis and node_redis work well in parallel. You can keep your existing code base unchanged and write new code using Promises.
Using romis.fromRedis
Keep your legacy code and re-use your exisitng client instance with the fromRedis function.
// keep your legacy code unchangedvar redis = require('redis');var client= redis.createClient();client.hset('hash key','some field', 'some value', function(err,result){ // do whatever});// re-use the redis client with romis.fromRedisvar romis = require('romis');var romisClient = romis.fromRedis(client);romisClient.hset('hash key','some field', 'some value').then(function(result){ // hello, Promises!
Using the _redis property
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 = require('romis'),var romisClient = romis.createClient();// call an old-style, callback-based methodromisClient._redis.hset('hash key','some value', function(err,result){ //});