class Rack::Cache::EntityStore::GAE
Attributes
cache[R]
Public Class Methods
new(options = {})
click to toggle source
# File lib/rack/cache/entity_store.rb, line 297 def initialize(options = {}) require 'rack/cache/app_engine' @cache = Rack::Cache::AppEngine::MemCache.new(options) end
resolve(uri)
click to toggle source
# File lib/rack/cache/entity_store.rb, line 330 def self.resolve(uri) self.new(:namespace => uri.host) end
Public Instance Methods
exist?(key)
click to toggle source
# File lib/rack/cache/entity_store.rb, line 302 def exist?(key) cache.contains?(key) end
open(key)
click to toggle source
# File lib/rack/cache/entity_store.rb, line 310 def open(key) if data = read(key) [data] else nil end end
purge(key)
click to toggle source
# File lib/rack/cache/entity_store.rb, line 325 def purge(key) cache.delete(key) nil end
read(key)
click to toggle source
# File lib/rack/cache/entity_store.rb, line 306 def read(key) cache.get(key) end
write(body, ttl=nil)
click to toggle source
# File lib/rack/cache/entity_store.rb, line 318 def write(body, ttl=nil) buf = StringIO.new key, size = slurp(body){|part| buf.write(part) } cache.put(key, buf.string, ttl) [key, size] end