Using Redis, I want to perform an atomic sequence of commands, i.e. I need to guarantee that no other client will perform changes in the database while the sequence is being executed.
If I used write commands only, I could use MULTI
and EXEC
statements to assure atomicity using transactions. However, I would also like to use read commands in my transactions. Hence I cannot use MULTI
, because read commands are also being queued!
Basically, in atomic manner, I need to do following:
- Read
x
from the database, - Based on
x
, storef(x)
to the database.
Both 1. and 2. should be part of a single, atomic transaction.
Is there a simple way how to do that?