List Commands
List commands allow you to store string elements in lists, supporting insertion and popping from both ends. Lists are ordered and can contain duplicate elements.
Command List
LINDEX
Returns the element at the specified index position in the list
LLEN
Returns the length of the list
LPOP
Removes and returns the first element of the list
LPUSH
Inserts one or more values at the head of the list
LPUSHX
Inserts a value at the head of an existing list
LRANGE
Returns elements in the specified range of the list
LSET
Sets the value of a list element by index
RPUSH
Inserts one or more values at the tail of the list
RPUSHX
Inserts a value at the tail of an existing list
RPOP
Removes and returns the last element of the list
Use Cases
List commands are ideal for message queues, timelines, recent browsing records, and other scenarios. The combination of LPUSH and RPOP (or RPUSH and LPOP) can implement queue functionality, while the combination of LPUSH and LPOP can implement stack functionality.
For detailed usage and parameters of each command, please refer to the individual command documentation linked above.