List Operations with Redis Commands
Learn and practice frequently used Redis commands to store list data in the Redis data store.
We’re going to explore the different commands that can be executed when dealing with lists in Redis. We’ll learn the five most commonly used Redis commands to store and retrieve data in a list format, which can be of great help in creating applications where we want to work with a list of items.
The LPUSH
command
The LPUSH
command is used to insert all the values provided in the command to the start (head) of the list. This command creates a new list with the given values, even if the key isn’t present. All the values are inserted from the left to the right in the list. The LPUSH
command returns an integer denoting the length of the list after insertion.
Syntax and example
The syntax of the LPUSH
command is shown below:
Get hands-on with 1400+ tech skills courses.