class Rack::Cache::MetaStore::Dalli

Public Class Methods

new(server="localhost:11211", options={}) click to toggle source
# File lib/rack/cache/metastore.rb, line 312
def initialize(server="localhost:11211", options={})
  @cache =
    if server.respond_to?(:stats)
      server
    else
      require 'dalli'
      ::Dalli::Client.new(server, options)
    end
end

Public Instance Methods

purge(key) click to toggle source
# File lib/rack/cache/metastore.rb, line 332
def purge(key)
  cache.delete(hexdigest(key))
  nil
end
read(key) click to toggle source
# File lib/rack/cache/metastore.rb, line 322
def read(key)
  key = hexdigest(key)
  cache.get(key) || []
end
write(key, entries) click to toggle source
# File lib/rack/cache/metastore.rb, line 327
def write(key, entries)
  key = hexdigest(key)
  cache.set(key, entries)
end