1
複数のプロセスが私のredisストアにアクセスできます。新しいユーザーハッシュを追加するとき、私は次の手順を実行します。ノードredis - id生成競合状態
- INCRユーザーID
- セットのユーザー:私はにこれらの手順をバンドルすることができますどのように[インクリメントのuserId] ...
トランザクション?
const client = require('redis').createClient();
client.on("connect",() => {
const multi = client.multi();
multi.incr("userId", (userId) => {
console.log("new userId is %s", userId); // TODO userId should not be null
multi.set("user:"+userId, {name:"UserName"});
});
multi.exec(); // TODO after the execution I expect to see the key user:null using redis-cli, but it does not exist
});