Class: Rhcf::Timeseries::RedisHgetallStrategy
- Inherits:
-
Object
- Object
- Rhcf::Timeseries::RedisHgetallStrategy
- Defined in:
- lib/rhcf/timeseries/redis_strategies.rb
Instance Method Summary collapse
- #crunch_values(manager, subject, resolution_id, point, filter, limit = 100) ⇒ Object
- #hgetall(manager, k, s, r, p) ⇒ Object
- #id ⇒ Object
- #store_point_value(manager, subject_path, resolution_name, resolution_value, point_value, event_path) ⇒ Object
Instance Method Details
#crunch_values(manager, subject, resolution_id, point, filter, limit = 100) ⇒ Object
8 9 10 11 12 |
# File 'lib/rhcf/timeseries/redis_strategies.rb', line 8 def crunch_values(manager, subject, resolution_id, point, filter, limit = 100) values = hgetall(manager, EVENT_POINT_TOKEN, subject, resolution_id, point) values.reject!{|event, value| !filter.match?(event) } if filter values end |
#hgetall(manager, k, s, r, p) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/rhcf/timeseries/redis_strategies.rb', line 20 def hgetall(manager, k,s,r,p) key = [ manager.prefix, k,s,r,p].join(NAMESPACE_SEPARATOR) manager.connection_to_use.hgetall(key).each_with_object({}) do |(_k, value), hash| hash[_k] = value.to_i end end |
#id ⇒ Object
4 5 6 |
# File 'lib/rhcf/timeseries/redis_strategies.rb', line 4 def id 'H' end |
#store_point_value(manager, subject_path, resolution_name, resolution_value, point_value, event_path) ⇒ Object
14 15 16 17 18 |
# File 'lib/rhcf/timeseries/redis_strategies.rb', line 14 def store_point_value(manager, subject_path, resolution_name, resolution_value, point_value, event_path) key = [manager.prefix, EVENT_POINT_TOKEN ,subject_path, resolution_name, resolution_value].join(NAMESPACE_SEPARATOR) manager.connection_to_use.hincrby(key, event_path, point_value) manager.connection_to_use.expire(key, DEFAULT_RESOLUTIONS_MAP[resolution_name][:ttl]) end |