Class | Rack::Cache::MetaStore::MemCacheBase |
In: |
lib/rack/cache/metastore.rb
|
Parent: | MetaStore |
Stores request/response pairs in memcached. Keys are not stored directly since memcached has a 250-byte limit on key names. Instead, the SHA1 hexdigest of the key is used.
cache | [R] | The MemCache object used to communicated with the memcached daemon. |
Create MemCache store for the given URI. The URI must specify a host and may specify a port, namespace, and options:
memcached://example.com:11211/namespace?opt1=val1&opt2=val2
Query parameter names and values are documented with the memcached library: tinyurl.com/4upqnd
# File lib/rack/cache/metastore.rb, line 286 286: def self.resolve(uri) 287: if uri.respond_to?(:scheme) 288: server = "#{uri.host}:#{uri.port || '11211'}" 289: options = parse_query(uri.query) 290: options.keys.each do |key| 291: value = 292: case value = options.delete(key) 293: when 'true' ; true 294: when 'false' ; false 295: else value.to_sym 296: end 297: options[key.to_sym] = value 298: end 299: 300: options[:namespace] = uri.path.to_s.sub(/^\//, '') 301: 302: new server, options 303: else 304: # if the object provided is not a URI, pass it straight through 305: # to the underlying implementation. 306: new uri 307: end 308: end