Redis 命令 - Transactions
DISCARD
Discard all commands issued after MULTI
127.0.0.1:6379> MGET bank:A:account bank:B:account 1) "400" 2) "600" 127.0.0.1:6379> MULTI OK 127.0.0.1:6379> DECRBY bank:A:account 100 QUEUED 127.0.0.1:6379> INCRBY bank:B:account 100 QUEUED 127.0.0.1:6379> DISCARD OK 127.0.0.1:6379> MGET bank:A:account bank:B:account 1) "400" 2) "600"
More: http://redis.io/commands/discard, http://www.redis.cn/commands/discard.html
EXEC
Execute all commands issued after MULTI
127.0.0.1:6379> MSET bank:A:account 500 bank:B:account 500 OK 127.0.0.1:6379> MULTI OK 127.0.0.1:6379> DECRBY bank:A:account 100 QUEUED 127.0.0.1:6379> INCRBY bank:B:account 100 QUEUED 127.0.0.1:6379> EXEC 1) (integer) 400 2) (integer) 600
More: http://redis.io/commands/exec, http://www.redis.cn/commands/exec.html
MULTI
Mark the start of a transaction block
127.0.0.1:6379> MSET bank:A:account 500 bank:B:account 500 OK 127.0.0.1:6379> MULTI OK 127.0.0.1:6379> DECRBY bank:A:account 100 QUEUED 127.0.0.1:6379> INCRBY bank:B:account 100 QUEUED 127.0.0.1:6379> EXEC 1) (integer) 400 2) (integer) 600
More: http://redis.io/commands/multi, http://www.redis.cn/commands/multi.html
UNWATCH
Forget about all watched keys
127.0.0.1:6379> WATCH key OK ...... ...... ...... 127.0.0.1:6379> UNWATCH OK
More: http://redis.io/commands/unwatch, http://www.redis.cn/commands/unwatch.html
WATCH key [key ...]
Watch the given keys to determine execution of the MULTI/EXEC block
127.0.0.1:6379> SET key 1 OK 127.0.0.1:6379> WATCH key OK 127.0.0.1:6379> SET key 2 OK 127.0.0.1:6379> MULTI OK 127.0.0.1:6379> SET key 3 QUEUED 127.0.0.1:6379> EXEC (nil) 127.0.0.1:6379> GET key "2"
More: http://redis.io/commands/watch, http://www.redis.cn/commands/watch.html
分类:
Redis
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core GC压缩(compact_phase)底层原理浅谈
· 现代计算机视觉入门之:什么是图片特征编码
· .NET 9 new features-C#13新的锁类型和语义
· Linux系统下SQL Server数据库镜像配置全流程详解
· 现代计算机视觉入门之:什么是视频
· 【译】我们最喜欢的2024年的 Visual Studio 新功能
· 个人数据保全计划:从印象笔记迁移到joplin
· Vue3.5常用特性整理
· 重拾 SSH:从基础到安全加固
· 为什么UNIX使用init进程启动其他进程?