class SidekiqUniqueJobs::Changelog

def page(cursor, pattern: "*", page_size: 100)

Returns:
  • (Array] the total size, next cursor and changelog entries) - Array] the total size, next cursor and changelog entries

Parameters:
  • page_size (Integer) -- 100 the number of matches to return
  • pattern (String) -- "*" the pattern to match
  • cursor (Integer) -- the cursor for this iteration
def page(cursor, pattern: "*", page_size: 100)
  redis do |conn|
    total_size, result = conn.multi do
      conn.zcard(key)
      conn.zscan(key, cursor, match: pattern, count: page_size)
    end
    [
      total_size,
      result[0], # next_cursor
      result[1].map { |entry| load_json(entry[0]) }, # entries
    ]
  end
end