Class: Rack::Cache::MetaStore::GAEStore

Inherits:
Rack::Cache::MetaStore show all
Defined in:
lib/rack/cache/metastore.rb

Constant Summary

Constants inherited from Rack::Cache::MetaStore

DISK, FILE, GAE, GAECACHE, HEAP, MEM, MEMCACHE, MEMCACHED

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Rack::Cache::MetaStore

#cache_key, #invalidate, #lookup, #store

Constructor Details

#initialize(options = {}) ⇒ GAEStore

Returns a new instance of GAEStore.



386
387
388
389
# File 'lib/rack/cache/metastore.rb', line 386

def initialize(options = {})
  require 'rack/cache/appengine'
  @cache = Rack::Cache::AppEngine::MemCache.new(options)
end

Instance Attribute Details

#cacheObject (readonly)

Returns the value of attribute cache.



384
385
386
# File 'lib/rack/cache/metastore.rb', line 384

def cache
  @cache
end

Class Method Details

.resolve(uri) ⇒ Object



407
408
409
# File 'lib/rack/cache/metastore.rb', line 407

def self.resolve(uri)
  self.new(:namespace => uri.host)
end

Instance Method Details

#purge(key) ⇒ Object



401
402
403
404
405
# File 'lib/rack/cache/metastore.rb', line 401

def purge(key)
  key = hexdigest(key)
  cache.delete(key)
  nil
end

#read(key) ⇒ Object



391
392
393
394
# File 'lib/rack/cache/metastore.rb', line 391

def read(key)
  key = hexdigest(key)
  cache.get(key) || []
end

#write(key, entries) ⇒ Object



396
397
398
399
# File 'lib/rack/cache/metastore.rb', line 396

def write(key, entries)
  key = hexdigest(key)
  cache.put(key, entries)
end