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

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -