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 295
295:       def initialize(options = {})
296:         require 'rack/cache/appengine'
297:         @cache = Rack::Cache::AppEngine::MemCache.new(options)
298:       end

[Source]

     # File lib/rack/cache/metastore.rb, line 378
378:       def initialize(options = {})
379:         require 'rack/cache/appengine'
380:         @cache = Rack::Cache::AppEngine::MemCache.new(options)
381:       end

[Source]

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

[Source]

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

Public Instance methods

[Source]

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

[Source]

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

[Source]

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

[Source]

     # File lib/rack/cache/metastore.rb, line 393
393:       def purge(key)
394:         key = hexdigest(key)
395:         cache.delete(key)
396:         nil
397:       end

[Source]

     # File lib/rack/cache/metastore.rb, line 383
383:       def read(key)
384:         key = hexdigest(key)
385:         cache.get(key) || []
386:       end

[Source]

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

[Source]

     # File lib/rack/cache/entitystore.rb, line 316
316:       def write(body)
317:         buf = StringIO.new
318:         key, size = slurp(body){|part| buf.write(part) }
319:         cache.put(key, buf.string)
320:         [key, size]
321:       end

[Source]

     # File lib/rack/cache/metastore.rb, line 388
388:       def write(key, entries)
389:         key = hexdigest(key)
390:         cache.put(key, entries)
391:       end

[Validate]