Class: Rack::Cache::MetaStore::MemCacheBase

### Home Classes Methods

### In Files

- lib/rack/cache/metastore.rb

### Parent

Rack::Cache::MetaStore

### Methods

- ::resolve

### Files

- CHANGES
- COPYING
- README
- TODO

### Class/Module Index

Quicksearch

- Rack
- Rack::Cache
- Rack::Cache::AppEngine
- Rack::Cache::AppEngine::MC
- Rack::Cache::AppEngine::MemCache
- Rack::Cache::CacheControl
- Rack::Cache::Context
- Rack::Cache::EntityStore
- Rack::Cache::EntityStore::DISK
- Rack::Cache::EntityStore::Dalli
- Rack::Cache::EntityStore::Disk
- Rack::Cache::EntityStore::FILE
- Rack::Cache::EntityStore::GAE
- Rack::Cache::EntityStore::GAECACHE
- Rack::Cache::EntityStore::GAEStore
- Rack::Cache::EntityStore::HEAP
- Rack::Cache::EntityStore::Heap
- Rack::Cache::EntityStore::MEM
- Rack::Cache::EntityStore::MemCacheBase
- Rack::Cache::EntityStore::MemCached
- Rack::Cache::Key
- Rack::Cache::MetaStore
- Rack::Cache::MetaStore::DISK
- Rack::Cache::MetaStore::Dalli
- Rack::Cache::MetaStore::Disk
- Rack::Cache::MetaStore::FILE
- Rack::Cache::MetaStore::GAE
- Rack::Cache::MetaStore::GAECACHE
- Rack::Cache::MetaStore::GAEStore
- Rack::Cache::MetaStore::HEAP
- Rack::Cache::MetaStore::Heap
- Rack::Cache::MetaStore::MEM
- Rack::Cache::MetaStore::MemCacheBase
- Rack::Cache::MetaStore::MemCached
- Rack::Cache::Options
- Rack::Cache::Request
- Rack::Cache::Response
- Rack::Cache::Storage

No matching classes.

# Rack::Cache::MetaStore::MemCacheBase

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.

### Attributes

cache[R]

The MemCache object used to communicated with the memcached daemon.

### Public Class Methods

resolve(uri) click to toggle source

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
    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.to_s.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

[Validate]

Generated with the Darkfish Rdoc Generator 2.