Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

namespace support symbol

  • Loading branch information...
commit 446863735714c08c7fd8ae3a0e29e1c246f29680 1 parent 5794335
Jingkai He jaxi authored
0  :wunderschoen}
View
No changes.
2  lib/dalli/client.rb
View
@@ -354,7 +354,7 @@ def key_without_namespace(key)
end
def namespace
- @options[:namespace].is_a?(Proc) ? @options[:namespace].call : @options[:namespace]
+ @options[:namespace].is_a?(Proc) ? @options[:namespace].call : @options[:namespace].to_s
end
def normalize_options(opts)
12 test/test_dalli.rb
View
@@ -23,6 +23,11 @@
end
end
end
+
+ it 'namespace attribute should be a string' do
+ dc = Dalli::Client.new('foo', :namespace => :wunderschoen)
+ assert_equal "wunderschoen", dc.send(:namespace)
+ end
end
describe 'key validation' do
@@ -42,6 +47,13 @@
end
end
end
+
+ it 'is OK if namespace is a symbol' do
+ memcached(19122, '', :namespace => :wunderschoen) do |dc|
+ dc.set "x" * 251, 1
+ assert 1, dc.get("#{'x' * 200}:md5:#{Digest::MD5.hexdigest('x' * 251)}")
+ end
+ end
end
it "default to localhost:11211" do
Please sign in to comment.
Something went wrong with that request. Please try again.