Redis - Using Incr value in a transaction
问题 Is it possible to use multi.incr(value) with multi.hmset ? I mean: var name = 'Josh'; var multi = client.multi(); multi.incr('id'); // incr => 1 multi.hmset('user:' + <need incr value here>, 'username', name); // I want multi.hmset('user:1', 'username', 'Josh'); multi.exec(function(err,data){ .. }); My objective is to increment 'id', and then set it to a user id in a transaction. I have read, that i need to do client.watch('id') , but i don't understand how to use it. PD: Please, post your