class Rhcf::Timeseries::RedisHgetallStrategy
Public Instance Methods
crunch_values(manager, subject, resolution_id, point, filter, limit = 100)
click to toggle source
# 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)
click to toggle source
# 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()
click to toggle source
# 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)
click to toggle source
# 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