Class: PulseMeter::Sensor::UniqCounter
- Defined in:
- lib/pulse-meter/sensor/uniq_counter.rb
Constant Summary
Constants included from Mixins::Dumper
Mixins::Dumper::DUMP_REDIS_KEY
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#event(name) ⇒ Object
Processes event.
-
#value ⇒ Fixnum
Returs number of unique values ever sent to counter.
Methods inherited from Counter
Methods inherited from Base
#annotate, #annotation, #cleanup, #initialize
Methods included from Mixins::Dumper
Constructor Details
This class inherits a constructor from PulseMeter::Sensor::Base
Instance Method Details
#event(name) ⇒ Object
Processes event
10 11 12 |
# File 'lib/pulse-meter/sensor/uniq_counter.rb', line 10 def event(name) redis.sadd(value_key, name) end |
#value ⇒ Fixnum
Returs number of unique values ever sent to counter
16 17 18 |
# File 'lib/pulse-meter/sensor/uniq_counter.rb', line 16 def value redis.scard(value_key) end |