RPOP key
Atomically return and remove the last (RPOP) element of the list.
TIME COMPLEXITY: O(1)
If the key does not exist or the list is already empty the special value 'nil' is returned.
RETURN VALUE: Bulk reply.
Syntax:
RPOP key
Example 1: When the list is present
redis:6379> LPUSH myList 100(integer) 1redis:6379> LPUSH myList 200(integer) 2redis:6379> LPUSH myList 300(integer) 3redis:6379> RPOP myList"100"
Output
100
Example 2: When the list is not present
redis:6379> RPOP myList2(nil)
Output
nil
No comments:
Post a Comment