runsv-redis
v2.0.1
Published
runsv redis service wrapper
Downloads
372
Readme
runsv Redis service
This is a service wrapper around the excellent node-redis for runsv.
Install
$ npm install runsv-redis
Usage with node-redis >= v4
const nodeRedis = require('redis');
const runsv = require('runsv').create().async();
const nodeRedisOptions = {
url:'...'
};
const redis = require('runsv-redis')(nodeRedis, nodeRedisOptions);
runsv.addService(redis);
await runsv.start();
const redisClient = runsv.getClients().redis;
await redisClient.hmset(["key", "foo", "bar"]);
Configure node-redis
You can configure your connection to Redis the same way you you do it with node-redis
.
Usage with node-redis v3
const nodeRedis = require('redis');
const runsv = require('runsv').create();
const redis = require('runsv-redis').v3(nodeRedis, 'redis://localhost:6379');
runsv.addService(redis);
runsv.start(function(err){
const redisClient = runsv.getClients().redis;
redisClient.hmset(["key", "foo", "bar"]);
});