Transactions
Run a group of commands as one step with MULTI and EXEC, with optimistic locking through WATCH.
DISCARD: Drops the commands queued since MULTI, ends the transaction, and stops watching keys.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 this connection watches.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.