Redis-things
If the multi is executed, it will be put in a queue.
Note:
In the statements that follow multi, this happens after a statement error
A, grammatical problems
Upon receipt of the exec, an error is reported and the statement is not executed.
B, the grammar is correct, but there is something wrong with the applicable object.
After exec, the correct statement is executed and the wrong one is skipped.
127.0.0.1 purl 6379 > flushdb
OK
127.0.0.1 set yang 6379 >
OK
127.0.0.1 set yu 6379 >
OK
127.0.0.1 purl 6379 > multi
OK
127.0.0.1 6379 > decrby yang 10
QUEUED
127.0.0.1 incrby yu 6379 >
QUEUED
127.0.0.1 purl 6379 > exec
1) (integer) 190
2) (integer) 200
127.0.0.1 purl 6379 > multi
OK
127.0.0.1 decrby yang 6379 >
QUEUED
127.0.0.1 purl 6379 > sadd yu jkjkjkjkj
QUEUED
127.0.0.1 purl 6379 > exec
1) (integer) 90
2) (error) WRONGTYPE Operation against a key holding the wrong kind of value
127.0.0.1 purl 6379 > mget yang yu
1) "90"
2) "200"
2, cancel the operation
127.0.0.1 purl 6379 > multi
OK
127.0.0.1 6379 > decrby yang 10
QUEUED
127.0.0.1 6379 > incrby yu 20000
QUEUED
127.0.0.1 purl 6379 > discard
OK
127.0.0.1 purl 6379 > mget yang yu
1) "90"
2) "200"
3The optimistic lock in key Reis, responsible for whether it has been changed.
Watch command