English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis Multi Command

Redis Transactions

The Redis Multi command is used to mark the start of a transaction block.

Multiple commands within a transaction block are enqueued in a queue in the order of execution, and finally executed atomically by the EXEC command.

Syntax

The basic syntax of the Redis Multi command is as follows:

redis 127.0.0.1:6379> Multi

Available Version

>= 1.2.0

Return Value

Always returns OK .

Online Examples

redis 127.0.0.1:6379> MULTI            # Mark the start of a transaction
OK
redis 127.0.0.1:6379> INCR user_id     # Multiple commands enqueued in order
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             # Execute
1) (integer) 1
2) (integer) 2
3) (integer) 3
4) PONG

Redis Transactions