class 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/meta_store.rb, line 354 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/meta_store.rb, line 377 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/meta_store.rb, line 365 def read(key) key = hexdigest(key) cache.get(key) rescue Memcached::NotFound [] end
write(key, entries)
click to toggle source
# File lib/rack/cache/meta_store.rb, line 372 def write(key, entries) key = hexdigest(key) cache.set(key, entries) end