Skip to main content

RPUSH

Syntax

RPUSH key element [element ...]

Time complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments.

ACL categories: @write, @list, @fast

Insert all the specified values at the tail of the list stored at key. If key does not exist, it is created as empty list before performing the push operation. When key holds a value that is not a list, an error is returned.

It is possible to push multiple elements using a single command call just specifying multiple arguments at the end of the command. Elements are inserted one after the other to the tail of the list, from the leftmost element to the rightmost element. So for instance the command RPUSH mylist a b c will result into a list containing a as first element, b as second element and c as third element.

Return

Integer reply: the length of the list after the push operation.

Examples

dragonfly> RPUSH mylist "hello"
(integer) 1
dragonfly> RPUSH mylist "world"
(integer) 2
dragonfly> LRANGE mylist 0 -1
1) "hello"
2) "world"

Benchmark

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

Dragonfly5,990,000OPS
Valkey893,5006.7× OPS
Redis698,8008.6× OPS
01.5M3.0M4.5M6.0M
operations / second
EngineThroughputp50p99p99.9Avg Latency
Dragonfly5.99M ops/s0.531 ms5.922 ms11.373 ms0.782 ms
Valkey893.5K ops/s5.197 ms11.570 ms15.476 ms5.359 ms
Redis698.8K ops/s6.573 ms11.298 ms17.824 ms6.856 ms

Methodology

HardwareServer: m7g.8xlarge (arm64) · Client: c6gn.8xlarge (arm64)
Client32 threads, 5 connections, pipeline 30
Dataset100M keys, 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.