0
0
Redisquery~10 mins

When to use pipelines 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 a Redis pipeline.

Redis
pipe = redis_client.[1]()
Drag options to blanks, or click blank then click option'
Apipeline
Bbatch
Cmulti
Dtransaction
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'transaction' instead of 'pipeline' causes errors because Redis uses 'pipeline()' method.
Using 'multi' or 'batch' are not valid Redis client methods.
2fill in blank
medium

Complete the code to add a command to the pipeline.

Redis
pipe.[1]('key', 'value')
Drag options to blanks, or click blank then click option'
Aset
Bexecute
Cadd
Dappend
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to use 'execute' to add commands is wrong; 'execute' runs all commands.
Using 'add' or 'append' are not Redis pipeline methods.
3fill in blank
hard

Fix the error in the code to run all pipeline commands.

Redis
result = pipe.[1]()
Drag options to blanks, or click blank then click option'
Arun
Bsend
Ccommit
Dexecute
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' or 'commit' causes AttributeError because those methods don't exist.
Using 'send' is not a Redis pipeline method.
4fill in blank
hard

Fill both blanks to create and execute a pipeline that sets two keys.

Redis
pipe = redis_client.[1]()
pipe.set('key1', 'val1')
pipe.set('key2', 'val2')
result = pipe.[2]()
Drag options to blanks, or click blank then click option'
Apipeline
Bexecute
Crun
Dtransaction
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'transaction' instead of 'pipeline' causes errors.
Using 'run' instead of 'execute' to run commands causes AttributeError.
5fill in blank
hard

Fill all three blanks to create a pipeline, add a command, and execute it.

Redis
pipe = redis_client.[1]()
pipe.[2]('counter', 1)
result = pipe.[3]()
Drag options to blanks, or click blank then click option'
Apipeline
Bincrby
Cexecute
Dincrement
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'increment' instead of 'incrby' causes errors.
Using 'run' instead of 'execute' causes AttributeError.