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 339
339:       def initialize(server="localhost:11211", options={})
340:         @cache =
341:           if server.respond_to?(:stats)
342:             server
343:           else
344:             require 'memcached'
345:             Memcached.new(server, options)
346:           end
347:       end

Public Instance methods

[Source]

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

[Source]

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

[Source]

     # File lib/rack/cache/metastore.rb, line 356
356:       def write(key, entries)
357:         key = hexdigest(key)
358:         cache.set(key, entries)
359:       end

[Validate]