Class: Nightfury::Metric::Value

Inherits:
Base
  • Object
show all
Defined in:
lib/nightfury/metric/value.rb

Constant Summary

Constants inherited from Base

Base::ALLOWED_STEPS

Instance Attribute Summary

Attributes inherited from Base

#name, #redis, #redis_key_prefix, #step, #store_as

Instance Method Summary collapse

Methods inherited from Base

#delete, #initialize, #redis_key

Constructor Details

This class inherits a constructor from Nightfury::Metric::Base

Instance Method Details

#decr(step = 1) ⇒ Object



17
18
19
# File 'lib/nightfury/metric/value.rb', line 17

def decr(step=1)
  redis.decrby(redis_key, step)
end

#getObject



9
10
11
# File 'lib/nightfury/metric/value.rb', line 9

def get
  redis.get(redis_key)
end

#incr(step = 1) ⇒ Object



13
14
15
# File 'lib/nightfury/metric/value.rb', line 13

def incr(step=1)
  redis.incrby(redis_key, step)
end

#set(value) ⇒ Object



4
5
6
7
# File 'lib/nightfury/metric/value.rb', line 4

def set(value)
  value = before_set(value)
  redis.set(redis_key, value)
end