YouTip LogoYouTip

Transactions Multi

.com

Learn not just technology, but dreams!

Redis Tutorial

Redis Commands

Advanced Redis Tutorials

Redis Multi Command

Up Redis Transactions

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

Multiple commands within the transaction block are queued in order, and finally executed atomically by the EXEC command.

Syntax

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

redis 127.0.0.1:6379> Multi

Available Version

>= 1.2.0

Return Value

Always returns OK.

Example

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 are queued in sequence
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
Up Redis Transactions

© 2024 .com. All rights reserved.

← Pub Sub SubscribeTransactions Exec β†’