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 'transaction' instead of 'pipeline'.
Trying to use 'multi' which is a Redis command but not the client method.
✗ Incorrect
To start a Redis pipeline, you call the pipeline() method on the client.
2fill in blank
mediumComplete the code to add a command to the pipeline.
Redis
pipe.[1]('set', 'key', 'value')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'execute' which runs the pipeline immediately.
Using 'send_command' which is not a standard pipeline method.
✗ Incorrect
The method execute_command adds a command to the pipeline queue.
3fill in blank
hardFix the error in the code to run the pipeline and get results.
Redis
results = pipe.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' which is not a Redis pipeline method.
Using 'commit' which is a database term but not for Redis pipelines.
✗ Incorrect
The correct method to run all queued commands in a Redis pipeline is execute().
4fill in blank
hardFill both blanks to create a pipeline, add a command, and execute it.
Redis
pipe = client.[1]() pipe.[2]('get', 'key') results = pipe.execute()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'transaction' instead of 'pipeline' to start.
Using 'send_command' instead of 'execute_command' to add commands.
✗ Incorrect
First, create the pipeline with pipeline(), then add commands with execute_command().
5fill in blank
hardFill all three blanks to create a pipeline, add two commands, and execute them.
Redis
pipe = client.[1]() pipe.[2]('set', 'a', '1') pipe.[3]('get', 'a') results = pipe.execute()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'transaction' instead of 'pipeline' to start.
Using 'send_command' which is not the standard method to add commands.
✗ Incorrect
Start the pipeline with pipeline(), then add commands with execute_command() twice before executing.