lib/rack/cache/entitystore.rb in rtomayko-rack-cache-0.5 vs lib/rack/cache/entitystore.rb in rtomayko-rack-cache-0.5.1
- old
+ new
@@ -180,22 +180,28 @@
data = read(key)
data && [data]
end
def self.resolve(uri)
- server = "#{uri.host}:#{uri.port || '11211'}"
- options = parse_query(uri.query)
- options.keys.each do |key|
- value =
- case value = options.delete(key)
- when 'true' ; true
- when 'false' ; false
- else value.to_sym
- end
- options[k.to_sym] = value
+ if uri.respond_to?(:scheme)
+ server = "#{uri.host}:#{uri.port || '11211'}"
+ options = parse_query(uri.query)
+ options.keys.each do |key|
+ value =
+ case value = options.delete(key)
+ when 'true' ; true
+ when 'false' ; false
+ else value.to_sym
+ end
+ options[k.to_sym] = value
+ end
+ options[:namespace] = uri.path.sub(/^\//, '')
+ new server, options
+ else
+ # if the object provided is not a URI, pass it straight through
+ # to the underlying implementation.
+ new uri
end
- options[:namespace] = uri.path.sub(/^\//, '')
- new server, options
end
end
# Uses the memcache-client ruby library. This is the default unless
# the memcached library has already been required.