Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Redis Rpoplpush Command

Redis Rpoplpush Command

Redis List

The Redis Rpoplpush command removes the last element of the list, appends it to another list, and returns it.

Syntax

The basic syntax of the redis Rpoplpush command is as follows:



redis 127.0.0.1:6379> RPOPLPUSH SOURCE_KEY_NAME DESTINATION_KEY_NAME

Available Version

= 1.0.0

Return Value

The popped element.

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> RPUSH mylist "bar"

(integer) 3

redis 127.0.0.1:6379> RPOPLPUSH mylist myotherlist

"bar"

redis 127.0.0.1:6379> LRANGE mylist 0 -1

1) "hello"

2) "foo"

Redis List