Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to start a pipeline in Redis client.
Redis
pipe = client.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'connect' instead of 'pipeline' to start a pipeline.
Trying to execute commands without starting a pipeline.
✗ Incorrect
To start a pipeline in Redis client libraries, you call pipeline() on the client object.
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
Calling 'set' directly on the pipeline object instead of 'send_command'.
Using 'execute' before adding commands.
✗ Incorrect
To add a command to the pipeline, use send_command with the command name and arguments.
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
Calling 'send_command' instead of 'execute' to run the pipeline.
Trying to call 'pipeline' again instead of executing.
✗ Incorrect
To run all commands in the pipeline and get results, call execute().
4fill in blank
hardFill both blanks to create a pipeline and add a GET command.
Redis
pipe = client.[1]() pipe.[2]('get', 'mykey')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'execute' to add commands instead of to run them.
Trying to connect instead of creating a pipeline.
✗ Incorrect
First, create a pipeline with pipeline(), then add commands with send_command().
5fill in blank
hardFill all three blanks to create a pipeline, add two commands, and execute it.
Redis
pipe = client.[1]() pipe.[2]('set', 'a', '1') pipe.[2]('get', 'a') results = pipe.[3]()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'flush' instead of 'execute' to run the pipeline.
Adding commands with 'execute' instead of 'send_command'.
✗ Incorrect
Start the pipeline with pipeline(), add commands with send_command(), and run all commands with execute().