Redis - node.js / ping or alive call -
i want check if connection redis db alive.
i want node.js - every 5 minutes send call db redis, , if connection lost, notify it.
i use following:
var db = require("redis"); var dbclient = db.createclient();
the problem don't see , alive/ping command supported package.
i suggest using events client provides:
var redis = require('redis'); var client = redis.createclient(); client.on('ready', function() { console.log('redis ready'); }).on('error', function(err) { // should assume here connection lost, or compromised. console.log('redis error', err); ... });
the error
event trigger regardless of whether command sent or not.
Comments
Post a Comment