Sha256: 627ee82ee2dd0825f12dadcc93c8e183a8172ce88ad0781df916088c287a9f02
Contents?: true
Size: 758 Bytes
Versions: 7
Compression:
Stored size: 758 Bytes
Contents
module RestFtpDaemon # Queue that stores all the Jobs waiting to be processed or fully processed class Counters attr_reader :stats def initialize @stats = {} @mutex_stats = Mutex.new end def set group, name, value @mutex_stats.synchronize do @stats[group] ||= {} @stats[group][name] = value end end def get group, name @mutex_stats.synchronize do @stats[group][name] if @stats[group].is_a? Hash end end def add group, name, value @mutex_stats.synchronize do @stats[group] ||= {} @stats[group][name] ||= 0 @stats[group][name] += value end end def increment group, name add group, name, 1 end end end
Version data entries
7 entries across 7 versions & 1 rubygems