Method: Redis::Commands::Lists#rpop

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

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

Remove and get the last 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 last elements



114
115
116
117
118
# File 'lib/redis/commands/lists.rb', line 114

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