LMOVE

Since 1.1.0Lists

Syntax

LMOVE source destination LEFT|RIGHT LEFT|RIGHT
  • Flags: write
  • ACL categories: @list, @slow, @write
  • Arity: 5

Removes an element from one end of source and adds it to one end of destination, in one step. LEFT is the head, RIGHT the tail. source and destination can be the same list, to rotate it.

Reply

  • The element moved.
  • nil if source does not exist.

Examples

> RPUSH src a b c
(integer) 3
> LMOVE src dst RIGHT LEFT
"c"
> LMOVE src dst LEFT RIGHT
"a"
> LRANGE dst 0 -1
1) "c"
2) "a"