lib/redistat/summary.rb in redistat-0.0.4 vs lib/redistat/summary.rb in redistat-0.0.5

- old
+ new

@@ -1,23 +1,23 @@ module Redistat class Summary include Database - def self.update_all(key, stats = {}, depth_limit = nil) + def self.update_all(key, stats = {}, depth_limit = nil, connection_ref = nil) stats ||= {} depth_limit ||= key.depth return nil if stats.size == 0 Date::DEPTHS.each do |depth| - update(key, stats, depth) + update(key, stats, depth, connection_ref) break if depth == depth_limit end end private - def self.update(key, stats, depth) + def self.update(key, stats, depth, connection_ref = nil) stats.each do |field, value| - db.hincrby key.to_s(depth), field, value + db(connection_ref).hincrby key.to_s(depth), field, value end end end end \ No newline at end of file