Method: Redis::Commands::Lists#lpop

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

#lpop(key, count = nil) ⇒ nil, ...

Remove and get the first elements in a list.

Parameters:

  • key (String)
  • count (Integer) (defaults to: nil)

    number of elements to remove

Returns:

  • (nil, String, Array<String>)

    the values of the first elements



103
104
105
106
107
# File 'lib/redis/commands/lists.rb', line 103

def lpop(key, count = nil)
  command = [:lpop, key]
  command << Integer(count) if count
  send_command(command)
end