From 57274ffb219db698238169de0ac53ae958d01b85 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Thu, 10 Mar 2011 00:30:14 +0000 Subject: [PATCH] updated reverse label hash lookup storage format, which might be a pain if you have been using the hashed_label option --- lib/redistat.rb | 2 +- lib/redistat/label.rb | 2 +- spec/label_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/redistat.rb b/lib/redistat.rb index 6aa628c..8d572e7 100644 --- a/lib/redistat.rb +++ b/lib/redistat.rb @@ -35,7 +35,7 @@ module Redistat KEY_NEXT_ID = ".next_id" KEY_EVENT = ".event:" - KEY_LEBELS = "Redistat.lables:" # TODO: Fix this typo, at some point. Might brack backwards compatability ^_^ + KEY_LEBELS = "Redistat.labels:" # used for reverse label hash lookup KEY_EVENT_IDS = ".event_ids" LABEL_INDEX = ".label_index:" GROUP_SEPARATOR = "/" diff --git a/lib/redistat/label.rb b/lib/redistat/label.rb index 89cfa02..6ff938d 100644 --- a/lib/redistat/label.rb +++ b/lib/redistat/label.rb @@ -29,7 +29,7 @@ module Redistat end def save - @saved = (db.set("#{KEY_LEBELS}#{hash}", self.to_s) == "OK") if @options[:hashed_label] + @saved = db.hset(KEY_LEBELS, hash, self.to_s) if @options[:hashed_label] self end diff --git a/spec/label_spec.rb b/spec/label_spec.rb index 8d38b09..8233f05 100644 --- a/spec/label_spec.rb +++ b/spec/label_spec.rb @@ -17,12 +17,12 @@ describe Redistat::Label do it "should store a label hash lookup key" do label = Redistat::Label.new(@name, {:hashed_label => true}).save label.saved?.should be_true - db.get("#{Redistat::KEY_LEBELS}#{label.hash}").should == @name + db.hget(Redistat::KEY_LEBELS, label.hash).should == @name name = "contact_us" label = Redistat::Label.create(name, {:hashed_label => true}) label.saved?.should be_true - db.get("#{Redistat::KEY_LEBELS}#{label.hash}").should == name + db.hget(Redistat::KEY_LEBELS, label.hash).should == name end describe "Grouping" do