Redis Rpushx Command

Redis List

The Redis Rpushx command is used to insert a value at the tail (rightmost) of an existing list. If the list does not exist, the operation is invalid.

Syntax

The basic syntax of the Redis Rpushx command is as follows:

redis 127.0.0.1:6379> RPUSHX KEY_NAME VALUE1..VALUEN

Available Versions

>= 2.2.0

Return Value

The length of the list after the Rpushx operation is performed.

Example

redis 127.0.0.1:6379> RPUSH mylist "hello"
(integer) 1
redis 127.0.0.1:6379> RPUSH mylist "foo"
(integer) 2
redis 127.0.0.1:6379> RPUSHX mylist2 "bar"
(integer) 0
redis 127.0.0.1:6379> LRANGE mylist 0 -1
1) "hello"
2) "foo"

Redis List

Other Extensions