class Rack::Cache::EntityStore::GAECACHE

Attributes

cache[R]

Public Class Methods

new(options = {}) click to toggle source
    # File lib/rack/cache/entity_store.rb
297 def initialize(options = {})
298   require 'rack/cache/app_engine'
299   @cache = Rack::Cache::AppEngine::MemCache.new(options)
300 end
resolve(uri) click to toggle source
    # File lib/rack/cache/entity_store.rb
330 def self.resolve(uri)
331   self.new(:namespace => uri.host)
332 end

Public Instance Methods

exist?(key) click to toggle source
    # File lib/rack/cache/entity_store.rb
302 def exist?(key)
303   cache.contains?(key)
304 end
open(key) click to toggle source
    # File lib/rack/cache/entity_store.rb
310 def open(key)
311   if data = read(key)
312     [data]
313   else
314     nil
315   end
316 end
purge(key) click to toggle source
    # File lib/rack/cache/entity_store.rb
325 def purge(key)
326   cache.delete(key)
327   nil
328 end
read(key) click to toggle source
    # File lib/rack/cache/entity_store.rb
306 def read(key)
307   cache.get(key)
308 end
write(body, ttl=nil) click to toggle source
    # File lib/rack/cache/entity_store.rb
318 def write(body, ttl=nil)
319   buf = StringIO.new
320   key, size = slurp(body){|part| buf.write(part) }
321   cache.put(key, buf.string, ttl)
322   [key, size]
323 end