Class: Rack::Cache::EntityStore::MemCacheBase

Inherits:
Rack::Cache::EntityStore show all
Extended by:
Utils
Defined in:
lib/rack/cache/entitystore.rb

Overview

Base class for memcached entity stores.

Direct Known Subclasses

MemCache, MemCached

Constant Summary

Constants inherited from Rack::Cache::EntityStore

DISK, FILE, GAE, GAECACHE, HEAP, MEM, MEMCACHE, MEMCACHED

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cacheObject (readonly)

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



175
176
177
# File 'lib/rack/cache/entitystore.rb', line 175

def cache
  @cache
end

Class Method Details

.resolve(uri) ⇒ Object



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/rack/cache/entitystore.rb', line 184

def self.resolve(uri)
  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[k.to_sym] = value
  end
  options[:namespace] = uri.path.sub(/^\//, '')
  new server, options
end

Instance Method Details

#open(key) ⇒ Object



179
180
181
182
# File 'lib/rack/cache/entitystore.rb', line 179

def open(key)
  data = read(key)
  data && [data]
end