Redis provides the LPOP and RPOP commands as a counterpart to the LPUSH and RPUSH commands for fetching data items.
If I was working with a list my_list that had several data items in it already, I can get the first item in the list using the LPOP command:
LPOP my_list
The result of this command will return the value of the first element from the list and remove it from my_list. For example, if I had the list [1, 3, 2, 4] and I applied LPOP to it, I would have the list [3, 2, 4] in memory afterwards.
Similarly, I can remove from the end of the list using RPOP:
RPOP my_list
would return the value fo the last element form the list and then remove it from my_list. Using our example, [1, 2, 3, 4] after calling RPOP on this list, the list in memory would be [1, 2, 3].