Redis - List Rpushx Command



Redis RPUSHX command inserts the value at the tail of the list stored at the key, only if the key already exists and holds a list. In contrary to RPUSH, no operation will be performed when the key does not yet exist.

Return Value

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

Syntax

Following is the basic syntax of Redis RPUSHX command.

redis 127.0.0.1:6379> RPUSHX KEY_NAME VALUE1..VALUEN

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_lists.htm
Advertisements