Class: Redistat::Summary
- Inherits:
-
Object
- Object
- Redistat::Summary
- Includes:
- Database
- Defined in:
- lib/redistat/summary.rb
Class Method Summary (collapse)
- + (Object) 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)
Methods included from Database
Class Method Details
+ (Object) buffer
13 14 15 |
# File 'lib/redistat/summary.rb', line 13 def buffer Redistat.buffer end |
+ (Object) default_options
7 8 9 10 11 |
# File 'lib/redistat/summary.rb', line 7 def { :enable_grouping => true, :label_indexing => true, :connection_ref => nil } end |
+ (Object) update(key, stats, depth_limit, opts)
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 |
+ (Object) update_all(key, stats = {}, depth_limit = nil, opts = {})
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 |
+ (Object) update_through_buffer(*args)
28 29 30 |
# File 'lib/redistat/summary.rb', line 28 def update_through_buffer(*args) update(*args) unless buffer.store(*args) end |