class Rack::Cache::EntityStore::GAECACHE

Attributes

cache[R]

Public Class Methods

new(options = {}) click to toggle source
    # File lib/rack/cache/entity_store.rb
291 def initialize(options = {})
292   require 'rack/cache/app_engine'
293   @cache = Rack::Cache::AppEngine::MemCache.new(options)
294 end
resolve(uri) click to toggle source
    # File lib/rack/cache/entity_store.rb
324 def self.resolve(uri)
325   self.new(:namespace => uri.host)
326 end

Public Instance Methods

exist?(key) click to toggle source
    # File lib/rack/cache/entity_store.rb
296 def exist?(key)
297   cache.contains?(key)
298 end
open(key) click to toggle source
    # File lib/rack/cache/entity_store.rb
304 def open(key)
305   if data = read(key)
306     [data]
307   else
308     nil
309   end
310 end
purge(key) click to toggle source
    # File lib/rack/cache/entity_store.rb
319 def purge(key)
320   cache.delete(key)
321   nil
322 end
read(key) click to toggle source
    # File lib/rack/cache/entity_store.rb
300 def read(key)
301   cache.get(key)
302 end
write(body, ttl=nil) click to toggle source
    # File lib/rack/cache/entity_store.rb
312 def write(body, ttl=nil)
313   buf = StringIO.new
314   key, size = slurp(body){|part| buf.write(part) }
315   cache.put(key, buf.string, ttl)
316   [key, size]
317 end