0
0
Redisquery~10 mins

DISCARD to abort 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 abort a Redis transaction using the DISCARD command.

Redis
MULTI
SET key1 value1
[1]
Drag options to blanks, or click blank then click option'
ADISCARD
BEXEC
CWATCH
DCOMMIT
Attempts:
3 left
💡 Hint
Common Mistakes
Using EXEC instead of DISCARD will execute the transaction instead of aborting it.
Using WATCH or COMMIT are not valid commands to abort a transaction.
2fill in blank
medium

Complete the code to start a transaction and then abort it properly.

Redis
MULTI
INCR counter
[1]
Drag options to blanks, or click blank then click option'
AEXEC
BSAVE
CROLLBACK
DDISCARD
Attempts:
3 left
💡 Hint
Common Mistakes
Using ROLLBACK which is not supported in Redis.
Using EXEC which executes the transaction instead of aborting.
3fill in blank
hard

Fix the error in the code to abort the transaction correctly.

Redis
MULTI
SET user:1 name Alice
[1]
Drag options to blanks, or click blank then click option'
AEXEC
BSAVE
CDISCARD
DCOMMIT
Attempts:
3 left
💡 Hint
Common Mistakes
Using COMMIT which is not a Redis command.
Using EXEC which executes the transaction instead of aborting.
4fill in blank
hard

Fill both blanks to start a transaction and then abort it.

Redis
[1]
HSET user:2 age 30
[2]
Drag options to blanks, or click blank then click option'
AMULTI
BDISCARD
CEXEC
DWATCH
Attempts:
3 left
💡 Hint
Common Mistakes
Using EXEC instead of DISCARD to abort.
Using WATCH to abort which only watches keys.
5fill in blank
hard

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

Redis
[1] user:3
[2]
DEL user:3
[3]
Drag options to blanks, or click blank then click option'
AWATCH
BMULTI
CDISCARD
DEXEC
Attempts:
3 left
💡 Hint
Common Mistakes
Using EXEC instead of DISCARD to abort.
Not using WATCH before MULTI when monitoring keys.