Transactions
Run a group of commands as one step with MULTI and EXEC, with optimistic locking through WATCH.
DISCARD: Ends a transaction without running it: the commands queued since MULTI are dropped, none of them runs, and the connection is back to running each command as it is sent.EXEC: Runs the commands queued since MULTI, as one step: no other client's command that could see their keys starts between two of them, reads included, so nobody sees the transaction half done.MULTI: Starts a transaction on this connection.UNWATCH: Stops watching every key the connection watches with WATCH, so that the next EXEC no longer depends on them.WATCH: Watches keys for the next transaction on this connection: if any of them is changed, by any client, before EXEC, the transaction runs nothing and EXEC replies nil.