I have simple hash:
client.hmset('aaa', {
'bbb': 'ccc',
'ddd': 'eee'
}, redis.print);
And I would like get all values from this hash, so I do:
client.hkeys('aaa', function(err, keys) {
if (err) throw err;
keys.forEach(function(key, i) {
client.hget('aaa', key, function(err, value) {
if (err) throw err;
console.log(key + ' : ' + value);
});
})
});
This work ok, show me:
bbb : ccc
ddd : eee
But is this efficient? Maybe is better way to get all values from hash with name "aaa"?
via yoxarir
No comments:
Post a Comment