.com
Learn not just technology, but dreams!
Redis Tutorial
Redis Commands
- Redis Commands
- Redis Keys (key)
- Redis Strings (String)
- Redis Hashes (Hash)
- Redis Lists (List)
- Redis Sets (Set)
- Redis Sorted Sets (sorted set)
- Redis HyperLogLog
- Redis Pub/Sub
- Redis Transactions
- Redis Scripting
- Redis Connection
- Redis Server
- Redis GEO
- Redis Stream
Advanced Redis Tutorials
- Redis Backup and Restore
- Redis Security
- Redis Performance Testing
- Redis Client Connection
- Redis Pipelining
- Redis Partitioning
- Java Using Redis
- PHP Using Redis
Redis Multi Command
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
YouTip