w3resource

Redis Lists: RPUSH

RPUSH key value1 [value2]

Redis RPUSH command is used to insert all the specified values at the tail of the list stored at key. It is created as an empty list before performing the push operation if the key does not exist. An error is returned when key holds such a value that is not a list.

Syntax:

RPUSH KEY_NAME VALUE1..VALUEN

Available since

1.0.0.

Return Value

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

Return Value Type

Integer

Example: Redis RPUSH

127.0.0.1:6379> RPUSH mycolor1 white black
(integer) 2
127.0.0.1:6379> RPUSH mycolor1 red blue
(integer) 4
127.0.0.1:6379> LRANGE mycolor1 0 -1
1) "white"
2) "black"
3) "red"
4) "blue"

Previous: RPOPLPUSH
Next: RPUSHX



Follow us on Facebook and Twitter for latest update.