Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to start a Redis transaction.
Redis
redisClient.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using EXEC instead of MULTI to start the transaction.
Using WATCH which is for monitoring keys, not starting transactions.
✗ Incorrect
The MULTI command starts a transaction block in Redis.
2fill in blank
mediumComplete the code to execute all commands queued in the transaction.
Redis
redisClient.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using MULTI instead of EXEC to run the transaction.
Using DISCARD which cancels the transaction.
✗ Incorrect
The EXEC command executes all commands queued after MULTI.
3fill in blank
hardFix the error in the code to cancel a Redis transaction.
Redis
redisClient.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using EXEC which executes the transaction instead of cancelling.
Using WATCH which is for monitoring keys, not cancelling.
✗ Incorrect
The DISCARD command cancels all commands queued in the current transaction.
4fill in blank
hardFill both blanks to watch a key and start a transaction.
Redis
redisClient.[1]('user:1') redisClient.[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 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.
Redis
redisClient.[1]('cart:123') redisClient.[2]() redisClient.[3]()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Executing before starting the transaction.
Not watching the key before starting the transaction.
✗ Incorrect
First WATCH the key, then MULTI to start the transaction, and finally EXEC to execute it.