LPOP key
Atomically returns and removes the first (LPOP) or last (RPOP) element of the list.
For example if the list contains the elements "a","b","c" LPOP will return "a" and the list will become "b","c".
TIME COMPLEXITY: O(1)
Note: If the key does not exist or the list is already empty the special value 'nil' is returned.
RETURN VALUE: Bulk reply.
Syntax:
LPOP KEY_NAME
Example 1: When the key is present and contains some values.
redis:6379> LPOP myList"300"
Output
300
Example 2: When the key is not present or empty list.
redis:6379> LPOP myList2(nil)
Output
nil
No comments:
Post a Comment