Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to start a Redis transaction.
Redis
redis_client.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using EXEC to start a transaction instead of MULTI.
Using WATCH which is for monitoring keys, not starting transactions.
✗ Incorrect
The MULTI command starts a transaction block in Redis, ensuring atomicity.
2fill in blank
mediumComplete the code to execute all commands in the Redis transaction atomically.
Redis
redis_client.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using MULTI to execute commands instead of starting the transaction.
Using DISCARD which cancels the transaction.
✗ Incorrect
The EXEC command executes all queued commands in the transaction atomically.
3fill in blank
hardFix the error in the code to discard a Redis transaction.
Redis
redis_client.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using EXEC which runs the transaction instead of discarding it.
Using MULTI which starts a transaction, not discards it.
✗ Incorrect
The DISCARD command cancels the transaction, discarding all queued commands.
4fill in blank
hardFill both blanks to watch a key and then start a transaction in Redis.
Redis
redis_client.[1]('mykey') redis_client.[2]()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using EXEC before MULTI.
Using DISCARD instead of MULTI to start the transaction.
✗ Incorrect
WATCH monitors the key for changes, and MULTI starts the transaction.
5fill in blank
hardFill all three blanks to watch a key, start a transaction, and execute it in Redis.
Redis
redis_client.[1]('session') redis_client.[2]() redis_client.[3]()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Executing before starting the transaction.
Discarding instead of executing the transaction.
✗ Incorrect
First, WATCH the key, then MULTI starts the transaction, and EXEC executes it atomically.