Skip to main content

LPOP

Syntax​

LPOP key [count]

Time complexity: O(N) where N is the number of elements returned

ACL categories: @write, @list, @fast

Removes and returns the first elements of the list stored at key.

By default, the command pops a single element from the beginning of the list. When provided with the optional count argument, the reply will consist of up to count elements, depending on the list's length.

Return​

When called without the count argument:

Bulk string reply: the value of the first element, or nil when key does not exist.

When called with the count argument:

Array reply: list of popped elements, or a null array when key does not exist.

Examples​

dragonfly> RPUSH mylist "one" "two" "three" "four" "five"
(integer) 5
dragonfly> LPOP mylist
"one"
dragonfly> LPOP mylist 2
1) "two"
2) "three"
dragonfly> LRANGE mylist 0 -1
1) "four"
2) "five"

Benchmark​

Sustained throughput for LPOP on a single instance, measured against Redis and Valkey on identical hardware. Higher is better.

Dragonfly10,250,000OPS
Valkey1,690,0006.1× OPS
Redis1,330,0007.7× OPS
02.63M5.25M7.88M10.5M
operations / second
EngineThroughputp50p99p99.9Avg Latency
Dragonfly10.25M ops/s0.432 ms0.871 ms3.507 ms0.456 ms
Valkey1.69M ops/s1.535 ms10.042 ms11.804 ms2.822 ms
Redis1.33M ops/s1.562 ms11.894 ms13.783 ms3.588 ms

Methodology

HardwareServer: m7g.8xlarge (arm64) · Client: c6gn.8xlarge (arm64)
Client32 threads, 5 connections, pipeline 30
Dataset1M keys, 100 preloaded items each, 128B values, uniform key distribution
Duration300s (10s warmup), 1 trial
Measured2026-07-29

Ran through dfly_bench until throughput stabilized; the reported figure is the median throughput sampled during the run. Harness and raw output: dragonflydb/benchmarking.