Class | Rack::Cache::EntityStore::Dalli |
In: |
lib/rack/cache/entitystore.rb
|
Parent: | MemCacheBase |
Uses the Dalli ruby library. This is the default unless the memcached library has already been required.
# File lib/rack/cache/entitystore.rb, line 210 210: def initialize(server="localhost:11211", options={}) 211: @cache = 212: if server.respond_to?(:stats) 213: server 214: else 215: require 'dalli' 216: ::Dalli::Client.new(server, options) 217: end 218: end
# File lib/rack/cache/entitystore.rb, line 220 220: def exist?(key) 221: !cache.get(key).nil? 222: end
# File lib/rack/cache/entitystore.rb, line 236 236: def purge(key) 237: cache.delete(key) 238: nil 239: end
# File lib/rack/cache/entitystore.rb, line 224 224: def read(key) 225: data = cache.get(key) 226: data.force_encoding('BINARY') if data.respond_to?(:force_encoding) 227: data 228: end