Class: MicroQ::Statistics::Default

Inherits:
Base
  • Object
show all
Defined in:
lib/micro_q/statistics/default.rb

Instance Attribute Summary

Attributes inherited from Base

#increment

Instance Method Summary collapse

Methods inherited from Base

instance, stats

Constructor Details

#initializeDefault

Returns a new instance of Default.



4
5
6
7
# File 'lib/micro_q/statistics/default.rb', line 4

def initialize
  @increment = Hash.new { 0 }
  @increment_mutex = Mutex.new
end

Instance Method Details

#incr(*keys) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/micro_q/statistics/default.rb', line 9

def incr(*keys)
  @increment_mutex.synchronize do
    keys.flatten.each do |key|
      @increment[key.to_s] += 1
    end
  end
end