From 22515337f6b101d5f537b2967e89e5e94ea09936 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Tue, 20 Jul 2010 15:40:55 +0300 Subject: [PATCH] call hmset once instead of multiple calls to hset --- lib/redistat/event.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/redistat/event.rb b/lib/redistat/event.rb index 39c34be..1d1615f 100644 --- a/lib/redistat/event.rb +++ b/lib/redistat/event.rb @@ -33,12 +33,13 @@ module Redistat #TODO store sumarized stats if @options[:store_event] - db.hset "#{KEY_EVENT_PREFIX}#{@id}", :scope, self.scope - db.hset "#{KEY_EVENT_PREFIX}#{@id}", :label, self.label - db.hset "#{KEY_EVENT_PREFIX}#{@id}", :date, self.date.to_time.to_s - db.hset "#{KEY_EVENT_PREFIX}#{@id}", :stats, self.stats.to_json - db.hset "#{KEY_EVENT_PREFIX}#{@id}", :meta, self.meta.to_json - db.hset "#{KEY_EVENT_PREFIX}#{@id}", :options, self.options.to_json + db.hmset("#{KEY_EVENT_PREFIX}#{@id}", + :scope, self.scope, + :label, self.label, + :date, self.date.to_time.to_s, + :stats, self.stats.to_json, + :meta, self.meta.to_json, + :options, self.options.to_json) db.sadd "#{self.scope}#{KEY_EVENT_IDS_SUFFIX}", @id end @new = false