Sha256: aaed52963bcb0b03e5fb74f82a8697fbdf7413232200c0043df3eb9fef20840c
Contents?: true
Size: 756 Bytes
Versions: 22
Compression:
Stored size: 756 Bytes
Contents
# Static counter module PulseMeter module Sensor class Counter < Base # Cleans up all sensor metadata in Redis def cleanup redis.del(value_key) super end # Increments counter value by 1 def incr event(1) end # Processes event by incremnting counter by given value # @param value [Fixnum] increment def event(value) redis.incrby(value_key, value.to_i) end # Gets counter value # @return [Fixnum] def value redis.get(value_key).to_i end # Gets redis key by which counter value is stored # @return [String] def value_key @value_key ||= "pulse_meter:value:#{name}" end end end end
Version data entries
22 entries across 22 versions & 2 rubygems