Skip to content

Instantly share code, notes, and snippets.

@octaflop
Last active December 13, 2015 23:18
Show Gist options
  • Select an option

  • Save octaflop/4990178 to your computer and use it in GitHub Desktop.

Select an option

Save octaflop/4990178 to your computer and use it in GitHub Desktop.
exports.get = function(req, cb) {
if (req.params.id) {
var id = req.params.id;
var ret = {};
var len = 4; // The number of calls we'll be making
function callback() {
--len || cb(ret);
}
client.hgetall(MODELSET_ID + ":blog:entry:" + id, function(err, reply) {
ret["metadata"] = reply;
callback();
});
client.hgetall(MODELSET_ID + ":blog:entry:" + id + ":content", function(err, reply) {
ret["content"] = reply;
callback();
});
client.hgetall(MODELSET_ID + ":blog:entry:" + id + ":author", function(err, reply) {
ret["author"] = reply;
callback();
});
client.hgetall(MODELSET_ID + ":blog:entry:" + id + ":datetime", function(err, reply) {
ret["datetime"] = reply;
callback();
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment