Rack::Cache::MetaStore::MemCached

Attributes

cache[R]

The Memcached instance used to communicated with the memcached daemon.

Public Class Methods

new(server="localhost:11211", options={}) click to toggle source
# File lib/rack/cache/metastore.rb, line 343
def initialize(server="localhost:11211", options={})
  options[:prefix_key] ||= options.delete(:namespace) if options.key?(:namespace)
  @cache =
    if server.respond_to?(:stats)
      server
    else
      require 'memcached'
      Memcached.new(server, options)
    end
end

Public Instance Methods

purge(key) click to toggle source
# File lib/rack/cache/metastore.rb, line 366
def purge(key)
  key = hexdigest(key)
  cache.delete(key)
  nil
rescue Memcached::NotFound
  nil
end
read(key) click to toggle source
# File lib/rack/cache/metastore.rb, line 354
def read(key)
  key = hexdigest(key)
  cache.get(key)
rescue Memcached::NotFound
  []
end
write(key, entries) click to toggle source
# File lib/rack/cache/metastore.rb, line 361
def write(key, entries)
  key = hexdigest(key)
  cache.set(key, entries)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.