Method: Redis::Commands::Lists#lmove

Defined in:
lib/redis/commands/lists.rb

#lmove(source, destination, where_source, where_destination) ⇒ nil, String

Note:

This command comes in place of the now deprecated RPOPLPUSH. Doing LMOVE RIGHT LEFT is equivalent.

Remove the first/last element in a list, append/prepend it to another list and return it.

Parameters:

  • source (String)

    source key

  • destination (String)

    destination key

  • where_source (String, Symbol)

    from where to remove the element from the source list e.g. ‘LEFT’ - from head, ‘RIGHT’ - from tail

  • where_destination (String, Symbol)

    where to push the element to the source list e.g. ‘LEFT’ - to head, ‘RIGHT’ - to tail

Returns:

  • (nil, String)

    the element, or nil when the source key does not exist



27
28
29
30
31
# File 'lib/redis/commands/lists.rb', line 27

def lmove(source, destination, where_source, where_destination)
  where_source, where_destination = _normalize_move_wheres(where_source, where_destination)

  send_command([:lmove, source, destination, where_source, where_destination])
end