Method: MessageBus::Backends::Redis#last_ids

Defined in:
lib/message_bus/backends/redis.rb

#last_ids(*channels) ⇒ Array<Integer>

Get the ID of the last message published on multiple channels

Parameters:

  • channels (Array<String>)
    • array of channels to fetch

Returns:

  • (Array<Integer>)

    the channel-specific IDs of the last message published to each requested channel



200
201
202
203
204
# File 'lib/message_bus/backends/redis.rb', line 200

def last_ids(*channels)
  return [] if channels.size == 0
  backlog_id_keys = channels.map { |c| backlog_id_key(c) }
  pub_redis.mget(*backlog_id_keys).map(&:to_i)
end