标签:href watch discard int queue pre centos 发送信息 centos7
原子操作: 事务中所有的命令要么全部执行,要么全部不执行
127.0.0.1:6379> MULTI # 开启事务
OK
127.0.0.1:6379> INCR user_id # user_id+1
QUEUED
127.0.0.1:6379> INCR user_id
QUEUED
127.0.0.1:6379> INCR user_id
QUEUED
127.0.0.1:6379> PING # 发送信息
QUEUED
127.0.0.1:6379> EXEC
1) (integer) 1
2) (integer) 2
3) (integer) 3
4) PONG
127.0.0.1:6379> MULTI
OK
127.0.0.1:6379> set username 'peigy'
QUEUED
127.0.0.1:6379> set password 'password'
QUEUED
127.0.0.1:6379> PING "set ok"
QUEUED
127.0.0.1:6379> DISCARD
OK
127.0.0.1:6379> set lock lock_times
OK
127.0.0.1:6379> watch lock lock_times
OK
127.0.0.1:6379> keys *
1) "user_id"
2) "lock"
127.0.0.1:6379> MULTI
OK
127.0.0.1:6379> set lock lock_times1
QUEUED
127.0.0.1:6379> EXEC
(nil)
127.0.0.1:6379> UNWATCH
OK
参考网站:http://redisdoc.com/transaction/index.html
标签:href watch discard int queue pre centos 发送信息 centos7
原文地址:https://www.cnblogs.com/leoshi/p/12318063.html