lib/redis_assist/finders.rb
def find_in_batches(options={})
      start       = options[:start]      || 0
      marker      = start
      batch_size  = options[:batch_size] || 500
      record_ids  = redis.zrange(index_key_for(:id), marker, marker + batch_size - 1)

      while record_ids.length > 0
        records_count   = record_ids.length
        marker          += records_count
        records         = find(record_ids)

        yield records

        break if records_count < batch_size

        record_ids = redis.zrange(index_key_for(:id), marker, marker + batch_size - 1)
      end
    end
def find_in_batches(options={})
      start       = options[:start]      || 0
      marker      = start
      batch_size  = options[:batch_size] || 500
      record_ids  = redis.zrange(index_key_for(:id), marker, marker + batch_size - 1)

      while record_ids.length > 0
        records_count   = record_ids.length
        marker          += records_count
        records         = find(record_ids)

        yield records

        break if records_count < batch_size

        record_ids = redis.zrange(index_key_for(:id), marker, marker + batch_size - 1)
      end
    end
Iterate over all records in batches
 @param options [Hash] accepts options
   `:start` to offset from the beginning of index,
   `:batch_size` the size of the batch, default is 500.
 @param &block [Proc] passes each batch of articles to the Proc.