Class Rack::Cache::GAEStore
In: lib/rack/cache/entitystore.rb
lib/rack/cache/metastore.rb
Parent: EntityStore

Methods

exist?   new   new   open   purge   purge   read   read   resolve   resolve   write   write  

Attributes

cache  [R] 
cache  [R] 

Public Class methods

[Source]

     # File lib/rack/cache/entitystore.rb, line 297
297:       def initialize(options = {})
298:         require 'rack/cache/appengine'
299:         @cache = Rack::Cache::AppEngine::MemCache.new(options)
300:       end

[Source]

     # File lib/rack/cache/metastore.rb, line 386
386:       def initialize(options = {})
387:         require 'rack/cache/appengine'
388:         @cache = Rack::Cache::AppEngine::MemCache.new(options)
389:       end

[Source]

     # File lib/rack/cache/entitystore.rb, line 330
330:       def self.resolve(uri)
331:         self.new(:namespace => uri.host)
332:       end

[Source]

     # File lib/rack/cache/metastore.rb, line 407
407:       def self.resolve(uri)
408:         self.new(:namespace => uri.host)
409:       end

Public Instance methods

[Source]

     # File lib/rack/cache/entitystore.rb, line 302
302:       def exist?(key)
303:         cache.contains?(key)
304:       end

[Source]

     # File lib/rack/cache/entitystore.rb, line 310
310:       def open(key)
311:         if data = read(key)
312:           [data]
313:         else
314:           nil
315:         end
316:       end

[Source]

     # File lib/rack/cache/entitystore.rb, line 325
325:       def purge(key)
326:         cache.delete(key)
327:         nil
328:       end

[Source]

     # File lib/rack/cache/metastore.rb, line 401
401:       def purge(key)
402:         key = hexdigest(key)
403:         cache.delete(key)
404:         nil
405:       end

[Source]

     # File lib/rack/cache/metastore.rb, line 391
391:       def read(key)
392:         key = hexdigest(key)
393:         cache.get(key) || []
394:       end

[Source]

     # File lib/rack/cache/entitystore.rb, line 306
306:       def read(key)
307:         cache.get(key)
308:       end

[Source]

     # File lib/rack/cache/entitystore.rb, line 318
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

[Source]

     # File lib/rack/cache/metastore.rb, line 396
396:       def write(key, entries)
397:         key = hexdigest(key)
398:         cache.put(key, entries)
399:       end

[Validate]