Redis Rpush command
Redis Rpush command is used to insert one or more values to the tail of the list (far right).
If the list does not exist, an empty list will be created and executed RPUSH operation. When the list exists but is not a list type, an error is returned.
Note: In the previous version of Redis 2.4 RPUSH command only accepts a single value value.
grammar
redis Rpush basic command syntax is as follows:
redis 127.0.0.1:6379> RPUSH KEY_NAME VALUE1..VALUEN
Available versions
> = 1.0.0
return value
After performing RPUSH operation, the length of the list.
Examples
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> RPUSH mylist "bar" (integer) 3 redis 127.0.0.1:6379> LRANGE mylist 0 -1 1) "hello" 2) "foo" 3) "bar"