class Rack::Cache::EntityStore::MemCacheBase

Base class for memcached entity stores.

Attributes

cache[R]

The underlying Memcached instance used to communicate with the memcached daemon.

Public Class Methods

resolve(uri) click to toggle source
# File lib/rack/cache/entitystore.rb, line 184
def self.resolve(uri)
  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[key.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
end

Public Instance Methods

open(key) click to toggle source
# File lib/rack/cache/entitystore.rb, line 179
def open(key)
  data = read(key)
  data && [data]
end