brandizzi brandizzi - 2 years ago 133
Node.js Question

Retrieving various hashes from Redis in Node.js

How could one retrieve various hashes from Redis in Node.js through node-redis? The best way of retrieving various hashes seems to be pipelines but I have not found how to use them in Node.

Answer Source

You can achieve that using the multi command to queue the hash retrieval commands:

var redis  = require("redis"),
    client = redis.createClient(),

multi_queue = client.multi();
for (key in keys) {

multi_queue.exec(function (err, replies) {
  console.log("MULTI got " + replies.length + " replies");
  replies.forEach(function (reply, index) {
    console.log("Reply " + index + ": " + reply.toString());
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download