Permalink
Browse files

Fix passing of options to Memcached and Dalli

  • Loading branch information...
1 parent 5fbea05 commit c696517fba3a1bb550bf73f26d4f6bcb2bf654da @kyledrake kyledrake committed Jun 24, 2011
Showing with 22 additions and 2 deletions.
  1. +1 −1 lib/rack/cache/entitystore.rb
  2. +1 −1 lib/rack/cache/metastore.rb
  3. +10 −0 test/entitystore_test.rb
  4. +10 −0 test/metastore_test.rb
View
2 lib/rack/cache/entitystore.rb
@@ -192,7 +192,7 @@ def self.resolve(uri)
when 'false' ; false
else value.to_sym
end
- options[k.to_sym] = value
+ options[key.to_sym] = value
end
options[:namespace] = uri.path.sub(/^\//, '')
new server, options
View
2 lib/rack/cache/metastore.rb
@@ -290,7 +290,7 @@ def self.resolve(uri)
when 'false' ; false
else value.to_sym
end
- options[k.to_sym] = value
+ options[key.to_sym] = value
end
options[:namespace] = uri.path.to_s.sub(/^\//, '')
View
10 test/entitystore_test.rb
@@ -185,6 +185,11 @@ def sha_like?
end
behaves_like 'A Rack::Cache::EntityStore Implementation'
end
+
+ it 'passes options from uri' do
+ memcached = Rack::Cache::EntityStore::Dalli.resolve URI.parse("memcached://#{ENV['MEMCACHED']}/meta?show_backtraces=true")
+ memcached.cache.instance_variable_get(:@options)[:show_backtraces].should.equal true
+ end
end
@@ -198,6 +203,11 @@ def sha_like?
@store = nil
end
behaves_like 'A Rack::Cache::EntityStore Implementation'
+
+ it 'passes options from uri' do
+ dalli = Rack::Cache::EntityStore::Dalli.resolve URI.parse("memcached://#{ENV['MEMCACHED']}/meta?compression=true")
+ dalli.cache.instance_variable_get(:@options)[:compression].should.equal true
+ end
end
end
View
10 test/metastore_test.rb
@@ -265,6 +265,11 @@ def self.call(request); request.path_info.reverse end
end
behaves_like 'A Rack::Cache::MetaStore Implementation'
end
+
+ it 'passes options from uri' do
+ memcached = Rack::Cache::EntityStore::Dalli.resolve URI.parse("memcached://#{ENV['MEMCACHED']}/meta?show_backtraces=true")
+ memcached.cache.instance_variable_get(:@options)[:show_backtraces].should.equal true
+ end
end
need_dalli 'metastore tests' do
@@ -277,6 +282,11 @@ def self.call(request); request.path_info.reverse end
end
behaves_like 'A Rack::Cache::MetaStore Implementation'
end
+
+ it 'passes options from uri' do
+ dalli = Rack::Cache::EntityStore::Dalli.resolve URI.parse("memcached://#{ENV['MEMCACHED']}/meta?compression=true")
+ dalli.cache.instance_variable_get(:@options)[:compression].should.equal true
+ end
end
need_java 'entity store testing' do

0 comments on commit c696517

Please sign in to comment.