Class: Rack::Cache::EntityStore::GAEStore
Constant Summary
DISK, FILE, GAE, GAECACHE, HEAP, MEM, MEMCACHE, MEMCACHED
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options = {}) ⇒ GAEStore
Returns a new instance of GAEStore.
289
290
291
292
|
# File 'lib/rack/cache/entitystore.rb', line 289
def initialize(options = {})
require 'rack/cache/appengine'
@cache = Rack::Cache::AppEngine::MemCache.new(options)
end
|
Instance Attribute Details
#cache ⇒ Object
Returns the value of attribute cache.
287
288
289
|
# File 'lib/rack/cache/entitystore.rb', line 287
def cache
@cache
end
|
Class Method Details
.resolve(uri) ⇒ Object
322
323
324
|
# File 'lib/rack/cache/entitystore.rb', line 322
def self.resolve(uri)
self.new(:namespace => uri.host)
end
|
Instance Method Details
#exist?(key) ⇒ Boolean
294
295
296
|
# File 'lib/rack/cache/entitystore.rb', line 294
def exist?(key)
cache.contains?(key)
end
|
#open(key) ⇒ Object
302
303
304
305
306
307
308
|
# File 'lib/rack/cache/entitystore.rb', line 302
def open(key)
if data = read(key)
[data]
else
nil
end
end
|
#purge(key) ⇒ Object
317
318
319
320
|
# File 'lib/rack/cache/entitystore.rb', line 317
def purge(key)
cache.delete(key)
nil
end
|
#read(key) ⇒ Object
298
299
300
|
# File 'lib/rack/cache/entitystore.rb', line 298
def read(key)
cache.get(key)
end
|
#write(body) ⇒ Object
310
311
312
313
314
315
|
# File 'lib/rack/cache/entitystore.rb', line 310
def write(body)
buf = StringIO.new
key, size = slurp(body){|part| buf.write(part) }
cache.put(key, buf.string)
[key, size]
end
|