Can anyone give me any ideas on how to ensure transactions using Express/Node and Redis?
This is a "GET then SET" operation in Redis. So, I'm trying to use WATCH to keep it Atomic.
As you can see, if I get two concurrent requests (on the same connection), EXEC will wipe out both of my WATCH concerns, and I end up with pop: 84 instead of pop: 85 (which is the correct answer). I don't want to have
1408725016.212430 [1 127.0.0.1:54388] "watch" "S70068T14087250"
1408725016.212461 [1 127.0.0.1:54388] "hgetall" "S70068T14087250"
1408725016.212519 [1 127.0.0.1:54388] "watch" "S70068T14087250"
1408725016.212537 [1 127.0.0.1:54388] "hgetall" "S70068T14087250"
1408725016.212602 [1 127.0.0.1:54388] "MULTI"
1408725016.212633 [1 127.0.0.1:54388] "hmset" "S70068T14087250" "pop" "84"
1408725016.212650 [1 127.0.0.1:54388] "EXEC"
1408725016.212703 [1 127.0.0.1:54388] "MULTI"
1408725016.212742 [1 127.0.0.1:54388] "hmset" "S70068T14087250" "pop" "84"
I'd rather not use LUA, is that my only option here?