Sha256: 63fe384685ccd5f88878a933c0417664e533278a48da1f5216e5df0a7574153b
Contents?: true
Size: 599 Bytes
Versions: 21
Compression:
Stored size: 599 Bytes
Contents
module CassandraObject module Batches extend ActiveSupport::Concern module ClassMethods def find_each connection.each(column_family) do |k, v| yield instantiate(k, v) end end def find_in_batches(options = {}) batch_size = options.delete(:batch_size) || 1000 batch = [] find_each do |record| batch << record if batch.size == batch_size yield(batch) batch = [] end end if batch.size > 0 yield batch end end end end end
Version data entries
21 entries across 21 versions & 1 rubygems