0
0
Redisquery~5 mins

EXEC to execute in Redis - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the Redis command EXEC do?
The EXEC command runs all the commands queued in a transaction started by MULTI. It executes them atomically (sequentially without interleaving from other clients).
Click to reveal answer
beginner
Which Redis command must be called before EXEC to start queuing commands?
The MULTI command starts a transaction and queues commands until EXEC is called to execute them.
Click to reveal answer
intermediate
What happens if a command inside a Redis transaction fails before EXEC is called?
Redis returns an error immediately for the invalid command (e.g., syntax error), does not queue it, but continues the transaction. EXEC executes all successfully queued commands.
Click to reveal answer
beginner
Can Redis commands queued in a transaction be executed partially with EXEC?
No. EXEC executes all queued commands atomically.
Click to reveal answer
beginner
How do you cancel a Redis transaction before calling EXEC?
Use the DISCARD command to cancel all queued commands and exit the transaction without executing them.
Click to reveal answer
What is the purpose of the Redis EXEC command?
ACheck the status of a transaction
BStart a new transaction
CCancel the current transaction
DExecute all commands queued in a transaction
Which command must be used before EXEC to queue commands in Redis?
ADISCARD
BEXEC
CMULTI
DWATCH
What happens if an invalid command is issued during a Redis transaction before EXEC runs?
AOnly valid commands execute
BTransaction is aborted and no commands run
CInvalid commands are skipped
DRedis fixes the invalid command automatically
How can you cancel a Redis transaction before executing it?
AUse <code>EXEC</code>
BUse <code>DISCARD</code>
CUse <code>WATCH</code>
DUse <code>FLUSHDB</code>
Is it possible to execute only some commands from a Redis transaction with EXEC?
ANo, all commands execute atomically
BYes, you can choose commands to execute
CYes, but only if commands are independent
DOnly if you use <code>WATCH</code>
Explain how the Redis EXEC command works in a transaction.
Think about how transactions ensure all commands run together.
You got /5 concepts.
    Describe the difference between EXEC and DISCARD in Redis transactions.
    One commits the transaction, the other cancels it.
    You got /4 concepts.