I used Only Redis as my DB, and my client is ServiceStack.Redis. The thing is, if two concurrent request need to update one key, then it can be a race condition. For example
A:
- int a = Get key
- MULTI
- a = a - 100
- Set key a
- EXEC
B:
- int a = Get key
- MULTI
- a = a - 100
- Set key a
- EXEC
if the origin "key" is 1000. If speration A and B are serialized, the right results of this two operations of "key" will be 800. But if A and B happens in the same time. Before A can commit, Operation B get value 1000 from "key", and set 900 to "key". That's not what I want. How can I prevent this kind of race conditions, use "WATCH"?