Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Invoke namespaced commands only when keys are present. Fixes #149

  • Loading branch information...
commit 0881c6c0fb2715636e59a4184841fb61595bbc92 1 parent d563933
@jodosha jodosha authored
View
4 redis-store/lib/redis/store/namespace.rb
@@ -30,11 +30,11 @@ def keys(pattern = "*")
end
def del(*keys)
- super *keys.map {|key| interpolate(key) }
+ super *keys.map {|key| interpolate(key) } if keys.any?
end
def mget(*keys)
- super *keys.map {|key| interpolate(key) }
+ super *keys.map {|key| interpolate(key) } if keys.any?
end
def to_s
View
12 redis-store/test/redis/store/namespace_test.rb
@@ -23,9 +23,9 @@ def teardown
@store.send(:interpolate, "#{@namespace}:rabbit").must_equal("#{@namespace}:rabbit")
end
- it "should ony delete namespaced keys" do
+ it "should only delete namespaced keys" do
other_store = Redis::Store.new
-
+
other_store.set 'abc', 'cba'
@store.set 'def', 'fed'
@@ -34,6 +34,12 @@ def teardown
other_store.get('abc').must_equal('cba')
end
+ it "should not try to delete missing namespaced keys" do
+ empty_store = Redis::Store.new :namespace => 'empty'
+ empty_store.flushdb
+ empty_store.keys.must_be_empty
+ end
+
it "namespaces get"
it "namespaces set"
it "namespaces setnx"
@@ -44,7 +50,7 @@ def teardown
it "namespaces incrby"
it "namespaces decrby"
it "namespaces mget"
-
+
# it "should namespace get" do
# @client.expects(:call).with([:get, "#{@namespace}:rabbit"]).once
# @store.get("rabbit")
Please sign in to comment.
Something went wrong with that request. Please try again.