Class: Redistat::Summary
- Inherits:
-
Object
- Object
- Redistat::Summary
- Includes:
- Database
- Defined in:
- lib/redistat/summary.rb
Class Method Summary collapse
- .buffer ⇒ Object
- .default_options ⇒ Object
- .update(key, stats, depth_limit, opts) ⇒ Object
- .update_all(key, stats = {}, depth_limit = nil, opts = {}) ⇒ Object
- .update_through_buffer(*args) ⇒ Object
Methods included from Database
Class Method Details
.default_options ⇒ Object
7 8 9 10 11 |
# File 'lib/redistat/summary.rb', line 7 def { :enable_grouping => true, :label_indexing => true, :connection_ref => nil } end |
.update(key, stats, depth_limit, opts) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/redistat/summary.rb', line 32 def update(key, stats, depth_limit, opts) if opts[:enable_grouping] stats = inject_group_summaries(stats) key.groups.each do |k| update_key(k, stats, depth_limit, opts[:connection_ref]) k.update_index if opts[:label_indexing] end else update_key(key, stats, depth_limit, opts[:connection_ref]) end end |
.update_all(key, stats = {}, depth_limit = nil, opts = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/redistat/summary.rb', line 17 def update_all(key, stats = {}, depth_limit = nil, opts = {}) stats ||= {} return if stats.empty? = .merge((opts || {}).reject { |k,v| v.nil? }) depth_limit ||= key.depth update_through_buffer(key, stats, depth_limit, ) end |
.update_through_buffer(*args) ⇒ Object
28 29 30 |
# File 'lib/redistat/summary.rb', line 28 def update_through_buffer(*args) update(*args) unless buffer.store(*args) end |