Sha256: 39afe671b2ce39f24a964c906db1a56657c83b03d8ace13ffd535902ee8f642a
Contents?: true
Size: 607 Bytes
Versions: 124
Compression:
Stored size: 607 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
124 entries across 124 versions & 2 rubygems