mirror of
https://github.com/jimeh/redistat.git
synced 2026-02-19 13:26:39 +00:00
Options are optional
This commit is contained in:
@@ -32,7 +32,7 @@ module Redistat
|
|||||||
update(*args) unless buffer.store(*args)
|
update(*args) unless buffer.store(*args)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update(key, stats, depth_limit, opts)
|
def update(key, stats, depth_limit, opts = {})
|
||||||
if opts[:enable_grouping]
|
if opts[:enable_grouping]
|
||||||
stats = inject_group_summaries(stats)
|
stats = inject_group_summaries(stats)
|
||||||
key.groups.each do |k|
|
key.groups.each do |k|
|
||||||
@@ -46,14 +46,14 @@ module Redistat
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def update_key(key, stats, depth_limit, opts)
|
def update_key(key, stats, depth_limit, opts = {})
|
||||||
Date::DEPTHS.each do |depth|
|
Date::DEPTHS.each do |depth|
|
||||||
update_fields(key, stats, depth, opts)
|
update_fields(key, stats, depth, opts)
|
||||||
break if depth == depth_limit
|
break if depth == depth_limit
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_fields(key, stats, depth, opts)
|
def update_fields(key, stats, depth, opts = {})
|
||||||
stats.each do |field, value|
|
stats.each do |field, value|
|
||||||
db(opts[:connection_ref]).hincrby key.to_s(depth), field, value
|
db(opts[:connection_ref]).hincrby key.to_s(depth), field, value
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user