Redis Multi 命令

更新时间: 2019-07-07 15:54

Redis Multi 命令用于标记一个事务块的开始。

事务块内的多条命令会按照先后顺序被放进一个队列当中,最后由 EXEC 命令原子性(atomic)地执行。

语法

redis Multi 命令基本语法如下:

redis 127.0.0.1:6379> Multi

可用版本

>= 1.2.0

返回值

总是返回 OK 。

实例

redis 127.0.0.1:6379> MULTI            # 标记事务开始
OK

redis 127.0.0.1:6379> INCR user_id     # 多条命令按顺序入队
QUEUED

redis 127.0.0.1:6379> INCR user_id
QUEUED

redis 127.0.0.1:6379> INCR user_id
QUEUED

redis 127.0.0.1:6379> PING
QUEUED

redis 127.0.0.1:6379> EXEC             # 执行
1) (integer) 1
2) (integer) 2
3) (integer) 3
4) PONG

查看更多 Redis 事务命令

The Art of Computer Programming, Volume 2

The Art of Computer Programming, Volume 2

Knuth, Donald E. / Addison-Wesley Professional / 1997-11-04 / USD 79.99

Finally, after a wait of more than thirty-five years, the first part of Volume 4 is at last ready for publication. Check out the boxed set that brings together Volumes 1 - 4A in one elegant case, and ......一起来看看 《The Art of Computer Programming, Volume 2》 这本书的介绍吧!

HTML 编码/解码

HTML 编码/解码

HTML 编码/解码

正则表达式在线测试

正则表达式在线测试

正则表达式在线测试

RGB CMYK 转换工具

RGB CMYK 转换工具

RGB CMYK 互转工具