How to use the redis.debug_mode function in redis

To help you get started, we’ve selected a few redis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github snodgrass23 / base12 / lib / redis / index.js View on Github external
if (app.config.redistogo_url) {
    try {
      var redis_connection = url.parse(app.config.redistogo_url);
      config = {
        host: redis_connection.hostname,
        port: redis_connection.port,
        auth: redis_connection.auth
      };
    }
    catch(e) {
      // error pulling redis_togo params
      console.log('Error pulling redis_togo params from ENV', app.config.redistogo_url, e);
    }
  }

  redis.debug_mode = config.debug;

  var client = redis.createClient(config.port, config.host);
  if (config.auth) {
    var auth = (config.auth.indexOf(":") > 0) ? config.auth.split(":")[1] : config.auth;
    client.auth(auth);
  }
  if (config.db) client.select(config.db);
  app.redis = client;

  client.on("ready", function() {
    console.log("Redis connected to: redis://"+config.host+":"+config.port);
  });

  client.on("error", function() {
    console.log("Error: Redis could not connect to: redis://"+config.host+":"+config.port);
  });
github fabioberger / Mobile-Live-Chat-Support-Server / pub.js View on Github external
var redis = require("redis");
var agent = redis.createClient();
var agent2 = redis.createClient();

redis.debug_mode = false;

// Most clients probably don't do much on "subscribe".  This example uses it to coordinate things within one program.
agent.on("subscribe", function (channel, count) {
    console.log("agent subscribed to " + channel + ", " + count + " total subscriptions");
});

agent.on("unsubscribe", function (channel, count) {
    console.log("agent unsubscribed from " + channel + ", " + count + " total subscriptions");
    if (count === 0) {
        customer.end();
        agent.end();
    }
});

agent.on("message", function (channel, message) {
    var msg = JSON.parse(message);
github TheBrousse / TitaniumMobileHotshot / 07-SecondToLastFantasyOnlineServer / node_modules / socket.io / node_modules / redis / examples / pub_sub.js View on Github external
var redis = require("redis"),
    client1 = redis.createClient(), msg_count = 0,
    client2 = redis.createClient();

redis.debug_mode = false;

// Most clients probably don't do much on "subscribe".  This example uses it to coordinate things within one program.
client1.on("subscribe", function (channel, count) {
    console.log("client1 subscribed to " + channel + ", " + count + " total subscriptions");
    if (count === 2) {
        client2.publish("a nice channel", "I am sending a message.");
        client2.publish("another one", "I am sending a second message.");
        client2.publish("a nice channel", "I am sending my last message.");
    }
});

client1.on("unsubscribe", function (channel, count) {
    console.log("client1 unsubscribed from " + channel + ", " + count + " total subscriptions");
    if (count === 0) {
        client2.end();
        client1.end();
github JakSprats / node_AlchemyDatabase / index.js View on Github external
var redis = require("redis");

//redis.debug_mode   = true;; // comment out
exports.debug_mode = redis.debug_mode;
var dbg            = redis.debug_mode;
var proto          = redis.RedisClient.prototype;

function to_array(args) { // helper borrowed from node_redis
    var i, len = args.length, arr = new Array(len);
    for (i = 0; i < len; i += 1) {
        arr[i] = args[i];
    }
    return arr;
}

function check_argc(command, args, argc) {
    var len = args.length - 1; // dont count the callback
    if (argc != len) {
        throw new Error("cmd: " + command + " argc: " + argc + " not: " + len);
    }
}
github JakSprats / node_AlchemyDatabase / index.js View on Github external
var redis = require("redis");

//redis.debug_mode   = true;; // comment out
exports.debug_mode = redis.debug_mode;
var dbg            = redis.debug_mode;
var proto          = redis.RedisClient.prototype;

function to_array(args) { // helper borrowed from node_redis
    var i, len = args.length, arr = new Array(len);
    for (i = 0; i < len; i += 1) {
        arr[i] = args[i];
    }
    return arr;
}

function check_argc(command, args, argc) {
    var len = args.length - 1; // dont count the callback
    if (argc != len) {
        throw new Error("cmd: " + command + " argc: " + argc + " not: " + len);
    }
github joyent / node-workflow / lib / workflow-redis-backend.js View on Github external
WorkflowRedisBackend.prototype.init = function (callback) {
  var self = this,
      port = self.config.port || 6379,
      host = self.config.host || '127.0.0.1',
      db_num = self.config.db || 1,
      redis = require('redis');


  if (self.config.debug) {
    redis.debug_mode = true;
  }

  self.client = redis.createClient(port, host, self.config);

  if (self.config.password) {
    self.client.auth(self.config.password);
  }

  self.client.on('error', function (err) {
    console.error('Redis error => ' + err.name + ':' + err.message);
  });

  self.client.on('connect', function () {
    self.client.select(db_num, function (err, res) {
      if (err) {
        throw err;
github mjackson / unpkg / server / utils / redis.js View on Github external
const redis = require("redis");

redis.debug_mode = process.env.DEBUG_REDIS != null;

const redisURL =
  process.env.OPENREDIS_URL ||
  process.env.REDIS_URL ||
  "redis://localhost:6379";

const client = redis.createClient(redisURL);

module.exports = client;
github mjackson / unpkg / modules / utils / cache.js View on Github external
const redis = require("redis");

redis.debug_mode = process.env.DEBUG_REDIS != null;

const client = redis.createClient(
  process.env.CACHE_URL || process.env.OPENREDIS_URL || "redis://localhost:6379"
);

module.exports = client;
github mjackson / unpkg / modules / utils / data.js View on Github external
import redis from 'redis';

redis.debug_mode = process.env.DEBUG_REDIS != null;

const client = redis.createClient(
  process.env.DATA_URL || process.env.OPENREDIS_URL || 'redis://localhost:6379'
);

export default client;