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 12 13 14 |
# File 'lib/redistat/summary.rb', line 7 def { :enable_grouping => true, :label_indexing => true, :connection_ref => nil, :expire => {} } end |
.update(key, stats, depth_limit, opts = {}) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/redistat/summary.rb', line 35 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) k.update_index if opts[:label_indexing] end else update_key(key, stats, depth_limit, opts) end end |
.update_all(key, stats = {}, depth_limit = nil, opts = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/redistat/summary.rb', line 20 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
31 32 33 |
# File 'lib/redistat/summary.rb', line 31 def update_through_buffer(*args) update(*args) unless buffer.store(*args) end |