Attributes
cache | [R] | The Memcached instance used to communicated with the memcached daemon. |
Public class methods
new
(server="localhost:11211", options={})
[show 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
purge
(key)
[show 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
read
(key)
[show 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
write
(key, entries)
[show 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