You have to read the documents in Transactions in Redis , transactions in Redis essentially combine several operations, so they are performed as one atomic operation.
Since these are only batch processing operations, you cannot perform any reads in the context of a transaction. Any reading you need before you need to find it before the transaction begins. Then you can use Redis WATCH to view any keys that should not be changed before the transaction is completed, if the key was changed, the transaction will fail and no operations will be processed.
source share