Skip to main content

Overview

Removes and returns the first element of the list stored at key. When a count is provided, removes and returns up to count elements.

Method Signature

Parameters

key
string
required
The key of the list.
count
number
The number of elements to pop. When specified, returns an array of elements instead of a single element.

Return Value

element
TData | null
When called without count: The first element of the list, or null if the list is empty or does not exist.When called with count: An array of popped elements, or null if the list is empty or does not exist.

Examples

Basic Usage

Pop Multiple Elements

Working with Objects

Queue Processing

Batch Processing

See Also

  • RPOP - Remove and return the last element of a list
  • LPUSH - Insert elements at the head of a list
  • LRANGE - Get a range of elements from a list
  • LLEN - Get the length of a list