mysql 事务
start transaction;
update ...
insert ...
create table的不行
rollback;//回滚
commit;//提交
redis 事务
multi
incrby age 1 //age+1
decrby age 2 //age-2
discard //取消执行 (discard 丢弃)
exec //执行
-----------------------
watch keyName1 keyName2 keyName3 ...
multi
incrby age 1 //age+1
decrby age 2 //age-2
exec //keyName1 keyName2 keyName3 ... 有变动执行不成功.
unwatch 取消watch
时间: 2024-11-07 20:12:49