我有一个用户数据库:个人资料、产品、配置和其他用户可以拥有的东西。我正在尝试找到一种方法来成功链接我的 redis 调用(一个“getAll”函数),以便我可以返回一个包含所有这些东西的对象,例如:
user = {
    profile: {},
    products: {},
    config: {},
    ...
}
这是我访问它们的方式/我正在尝试做的事情:
User.getAll = function(uid, next){
    var user = {};
    var multi = client.multi();
    var key = 'user' + uid;
    client.hgetall(key, function(err, profile){
        user.profile = profile;
        //signal that profile is ready
    }
    key = 'products:' + uid;
    client.smembers(key, function(err, arr){
        key = key + ':';
        for (i=0; i < arr.length; i++){
            multi.hgetall(key + arr[i]);
        }
        multi.exec(function(err, products){
            user.products = products;
            //signal that products is ready
        }));
    })
    if (ready) { //obviously this isn't correct.
      return next(null, user);
    }
}
收到所有我想要的数据后如何恢复?事件发射器是正确的方法吗?