Challenge - 5 Problems
Redis Transaction Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate1:30remaining
What is the output after starting a transaction with MULTI?
You run the command
MULTI in Redis to start a transaction. What is the immediate output you receive?Redis
MULTI
Attempts:
2 left
💡 Hint
Think about what Redis replies when a command is accepted successfully.
✗ Incorrect
The MULTI command replies with +OK to indicate the transaction block has started successfully.
🧠 Conceptual
intermediate1:30remaining
What happens to commands after MULTI is called?
After you run
MULTI, what happens to the commands you send before calling EXEC?Attempts:
2 left
💡 Hint
Think about how transactions work in Redis.
✗ Incorrect
After MULTI, commands are queued and only executed when EXEC is called.
📝 Syntax
advanced2:00remaining
Which command sequence correctly starts and executes a transaction?
Choose the correct sequence of Redis commands to start a transaction, set a key, and execute the transaction.
Attempts:
2 left
💡 Hint
MULTI must come before queuing commands, and EXEC must come last.
✗ Incorrect
The correct order is to start with MULTI, queue commands, then call EXEC to run them.
🔧 Debug
advanced2:00remaining
Why does this transaction fail to execute commands?
You run these commands:
MULTI
EXEC
SET key1 value1
What is the problem?
Attempts:
2 left
💡 Hint
Consider the order commands must be sent in a transaction.
✗ Incorrect
Commands must be queued between MULTI and EXEC. Here, SET is after EXEC, so it is executed outside the transaction.
❓ optimization
expert2:30remaining
How does using MULTI improve Redis command execution?
What is a key benefit of wrapping multiple commands inside MULTI/EXEC in Redis?
Attempts:
2 left
💡 Hint
Think about what atomicity means in transactions.
✗ Incorrect
MULTI/EXEC ensures all commands run as a single atomic operation, preventing partial execution.