Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to start a Redis pipeline.
Redis
pipe = client.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using execute() instead of pipeline() to start the pipeline.
Confusing multi() with pipeline().
✗ Incorrect
To send multiple commands in a pipeline, you start with client.pipeline().
2fill in blank
mediumComplete the code to add a SET command to the pipeline.
Redis
pipe.[1]('key1', 'value1')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using get() instead of set() to add a SET command.
Using delete() which removes keys instead of storing a value.
✗ Incorrect
To add a SET command in Redis pipeline, use pipe.set().
3fill in blank
hardFix the error in the code to execute the pipeline.
Redis
results = pipe.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using start() or commit() which do not exist in Redis pipeline.
Using run() which is not a Redis pipeline method.
✗ Incorrect
To send all commands in the pipeline to Redis and get results, use pipe.execute().
4fill in blank
hardFill both blanks to add two commands and execute the pipeline.
Redis
pipe.[1]('key2', 'value2') pipe.[2]('key2') results = pipe.execute()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using get() before set() which may return None.
Using delete() which removes keys instead of retrieving.
✗ Incorrect
First add a SET command, then a GET command before executing the pipeline.
5fill in blank
hardFill all three blanks to add SET, INCR, and GET commands in the pipeline.
Redis
pipe.[1]('counter', 1) pipe.[2]('counter') pipe.[3]('counter') results = pipe.execute()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using delete() which removes the key instead of incrementing.
Mixing order of commands causing unexpected results.
✗ Incorrect
First set the counter to 1, then increment it, then get its value before executing.