In a redis datastore I have a list of keys, I want to iterate over that list of keys and get those values from redis. The catch is I am using an event driven language, javascri
If you find yourself needing to use patterns like this often, then you may be interested in trying out the async.js library. Using async.js you could write something like this:
function getAll(callback) {
redis.lrange('mykey', 0, -1, function(err, reply) {
async.concat(reply, redis.hgetall, callback);
});
};
Which basically means "call hgetall on each item in 'reply' then concat all the results and pass to the callback".