How to use the redis.print 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 FeelTrainCoop / supermute / lib / classes / stream.js View on Github external
};
      this.userid = profile.id_str;
      let creds = userdata.credentials;
      // use the application's consumer stuff but the user's access stuff
      creds.consumer_key = this.app.get('twitterCredentials').consumer_key;
      creds.consumer_secret = this.app.get('twitterCredentials').consumer_secret;
      console.log(creds);
      this.T = new Twit(creds);

      // This user doesn't exist in the DB yet so we create a blank entry
      // and include the new keyword and expiration date
      // mutedUsers and isExpired are empty because we're intializing
      if (!exists) {
        console.log(`writing ${profile.id_str} to database...`);
        // TODO hash our application credentials???? maybe??
        client.hset(`supermute-users`, profile.id_str, JSON.stringify(userdata), redis.print);
        // save our userdata to this stream object
        this.userdata = userdata;
      }
      else {
        // do nothing
      }

      // start the stream
      this.start(UNMUTE);
    });
  }
github Wikia / app / extensions / wikia / Chat / js / server.js View on Github external
rc.llen(chatEntriesInRoomKey, function(err, len){
		if(err){
			console.log("Error: while trying to get length of list of messages in '" + chatEntriesInRoomKey + "'. Error msg: " + err);
		} else if( len > config.MAX_MESSAGES_IN_BACKLOG + 1 ){
			console.log("Found a bunch of extra messages in '" + chatEntriesInRoomKey + "'.  Getting rid of the oldest " + (len - config.MAX_MESSAGES_IN_BACKLOG) + " of them.");
			rc.ltrim(chatEntriesInRoomKey, (-1 * config.MAX_MESSAGES_IN_BACKLOG), -1, redis.print);
		} else if( len == (config.MAX_MESSAGES_IN_BACKLOG + 1)){
			// This seems like it'd be faster than ltrim even though ltrim says it's O(N) where N is number to remove and this is O(1).
			console.log("Trimming extra entry from list of messages in '" + chatEntriesInRoomKey + "'");
			rc.lpop(chatEntriesInRoomKey, redis.print);
		}
	});
	console.log("Done pruning any old messages in room (if needed).");
github TheBrousse / TitaniumMobileHotshot / 07-SecondToLastFantasyOnlineServer / node_modules / socket.io / node_modules / redis / examples / simple.js View on Github external
var redis = require("redis"),
    client = redis.createClient();

client.on("error", function (err) {
    console.log("error event - " + client.host + ":" + client.port + " - " + err);
});

client.set("string key", "string val", redis.print);
client.hset("hash key", "hashtest 1", "some value", redis.print);
client.hset(["hash key", "hashtest 2", "some other value"], redis.print);
client.hkeys("hash key", function (err, replies) {
    if (err) {
        return console.error("error response - " + err);
    }

    console.log(replies.length + " replies:");
    replies.forEach(function (reply, i) {
        console.log("    " + i + ": " + reply);
    });
});

client.quit(function (err, res) {
    console.log("Exiting from quit command.");
});
github lbryio / lbry.tech / github.js View on Github external
}).then(function({data}) {

  console.log(data);

  redisClient.set('events', JSON.stringify(data), redis.print);

});
github WuChenDi / Front-End / 07-nodejs / blog-1 / src / db / redis.js View on Github external
function set(key, val) {
    if (typeof val === "object") {
        val = JSON.stringify(val);
    }
    redisClient.set(key, val, redis.print);
}
github mchmarny / mqtt-bridge / backends / redis-backend.js View on Github external
RedisBackend.prototype.save = function(topic, data) {
	if (!topic || !data) return;
	var self = this;
	var cleanTopic = utils.replaceAll("/", "-", topic);
	var key = self.keyPrefix + ":" + cleanTopic + ":" + (new Date).getTime(); 
	self.logger.debug("[%s] %s > %s", self.config.index, cleanTopic, data);
	self.client.set(key, data.toString(), redis.print);
};
github wefront / node-codis / dist / index.js View on Github external
var NodeCodis = /** @class */ (function (_super) {
    __extends(NodeCodis, _super);
    function NodeCodis(opts) {
        var _this = this;
        opts.redisClient = 'redis';
        _this = _super.call(this, opts) || this;
        return _this;
    }
    NodeCodis.getRandomClient = function (clientsMap) {
        return _super.getRandomClient.call(this, clientsMap);
    };
    NodeCodis.print = redis.print;
    return NodeCodis;
}(BaseCodis));
exports.NodeCodis = NodeCodis;
github artsmia / collection-elasticsearch / search.js View on Github external
client.get(cacheKey, function(err, reply) {
    if(!!req.query.expireCache && reply) {
      client.del(cacheKey, redis.print)

      reply = JSON.parse(reply)
      reply.cache.expiring = true
      reply = JSON.stringify(reply)
    }

    return callback(err, reply, cacheKey)
  })
}