Class Rack::Cache::MetaStore::MemCached
In: lib/rack/cache/metastore.rb
Parent: MemCacheBase

Methods

new   purge   read   write  

Attributes

cache  [R]  The Memcached instance used to communicated with the memcached daemon.

Public Class methods

[Source]

     # File lib/rack/cache/metastore.rb, line 336
336:       def initialize(server="localhost:11211", options={})
337:         @cache =
338:           if server.respond_to?(:stats)
339:             server
340:           else
341:             require 'memcached'
342:             Memcached.new(server, options)
343:           end
344:       end

Public Instance methods

[Source]

     # File lib/rack/cache/metastore.rb, line 358
358:       def purge(key)
359:         key = hexdigest(key)
360:         cache.delete(key)
361:         nil
362:       rescue Memcached::NotFound
363:         nil
364:       end

[Source]

     # File lib/rack/cache/metastore.rb, line 346
346:       def read(key)
347:         key = hexdigest(key)
348:         cache.get(key)
349:       rescue Memcached::NotFound
350:         []
351:       end

[Source]

     # File lib/rack/cache/metastore.rb, line 353
353:       def write(key, entries)
354:         key = hexdigest(key)
355:         cache.set(key, entries)
356:       end

[Validate]