1
여러 프로세스가 내 redis 저장소에 대한 액세스 권한이 있습니다. 새로운 사용자 해시를 추가 할 때, 나는 다음과 같은 단계를 수행합니다노드 redis - id 생성 경쟁 조건
- 증분 사용자 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
});