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.

Methods

resolve  

Attributes

cache  [R]  The MemCache object used to communicated with the memcached daemon.

Public Class methods

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

[Source]

     # File lib/rack/cache/metastore.rb, line 282
282:       def self.resolve(uri)
283:         if uri.respond_to?(:scheme)
284:           server = "#{uri.host}:#{uri.port || '11211'}"
285:           options = parse_query(uri.query)
286:           options.keys.each do |key|
287:             value =
288:               case value = options.delete(key)
289:               when 'true' ; true
290:               when 'false' ; false
291:               else value.to_sym
292:               end
293:             options[key.to_sym] = value
294:           end
295: 
296:           options[:namespace] = uri.path.to_s.sub(/^\//, '')
297: 
298:           new server, options
299:         else
300:           # if the object provided is not a URI, pass it straight through
301:           # to the underlying implementation.
302:           new uri
303:         end
304:       end

[Validate]