0
0
Redisquery~10 mins

WATCH for optimistic locking in Redis - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start watching a key for optimistic locking.

Redis
redis_client.[1]('mykey')
Drag options to blanks, or click blank then click option'
Amulti
Bwatch
Cexec
Dunwatch
Attempts:
3 left
💡 Hint
Common Mistakes
Using MULTI instead of WATCH to monitor keys.
Using EXEC before WATCH.
Using UNWATCH to start watching keys.
2fill in blank
medium

Complete the code to start a transaction after watching keys.

Redis
redis_client.[1]()
Drag options to blanks, or click blank then click option'
Amulti
Bwatch
Cexec
Dunwatch
Attempts:
3 left
💡 Hint
Common Mistakes
Using WATCH instead of MULTI to start a transaction.
Using EXEC before MULTI.
Using UNWATCH to start a transaction.
3fill in blank
hard

Fix the error in the code to execute the transaction and release the watch.

Redis
redis_client.[1]()
Drag options to blanks, or click blank then click option'
Amulti
Bwatch
Cunwatch
Dexec
Attempts:
3 left
💡 Hint
Common Mistakes
Using MULTI instead of EXEC to run the transaction.
Using WATCH to execute commands.
Using UNWATCH before executing the transaction.
4fill in blank
hard

Fill both blanks to unwatch keys and discard the transaction.

Redis
redis_client.[1]()
redis_client.[2]()
Drag options to blanks, or click blank then click option'
Aunwatch
Bdiscard
Cexec
Dmulti
Attempts:
3 left
💡 Hint
Common Mistakes
Using EXEC instead of DISCARD to cancel the transaction.
Using MULTI instead of UNWATCH to stop watching keys.
Not calling UNWATCH before DISCARD.
5fill in blank
hard

Fill all three blanks to watch a key, start a transaction, and execute it.

Redis
redis_client.[1]('counter')
redis_client.[2]()
redis_client.[3]()
Drag options to blanks, or click blank then click option'
Awatch
Bmulti
Cexec
Dunwatch
Attempts:
3 left
💡 Hint
Common Mistakes
Skipping WATCH before MULTI.
Using UNWATCH instead of EXEC to run the transaction.
Calling EXEC before MULTI.