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 the transaction instead of MULTI.
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 in the Redis transaction.
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 commands queued in the transaction.
3fill in blank
hardFix the error in the code to watch keys for changes before starting a transaction.
Redis
redis_client.[1]('key1', 'key2') redis_client.MULTI()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using EXEC or MULTI instead of WATCH to monitor keys.
Using DISCARD which cancels the transaction.
✗ Incorrect
The WATCH command monitors keys for changes to ensure transaction consistency.
4fill in blank
hardFill both blanks to discard a transaction and unwatch keys.
Redis
redis_client.[1]() redis_client.[2]()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using EXEC instead of DISCARD to cancel.
Using MULTI instead of UNWATCH to stop watching.
✗ Incorrect
DISCARD cancels the transaction, and UNWATCH stops watching keys.
5fill in blank
hardFill all three blanks to watch keys, start a transaction, and execute it.
Redis
redis_client.[1]('keyA', 'keyB') redis_client.[2]() redis_client.[3]()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the order of commands.
Using DISCARD instead of EXEC to run the transaction.
✗ Incorrect
First, WATCH monitors keys, then MULTI starts the transaction, and finally EXEC executes it.