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.
295
296
297
298
|
# File 'lib/rack/cache/entitystore.rb', line 295
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.
293
294
295
|
# File 'lib/rack/cache/entitystore.rb', line 293
def cache
@cache
end
|
Class Method Details
.resolve(uri) ⇒ Object
328
329
330
|
# File 'lib/rack/cache/entitystore.rb', line 328
def self.resolve(uri)
self.new(:namespace => uri.host)
end
|
Instance Method Details
#exist?(key) ⇒ Boolean
300
301
302
|
# File 'lib/rack/cache/entitystore.rb', line 300
def exist?(key)
cache.contains?(key)
end
|
#open(key) ⇒ Object
308
309
310
311
312
313
314
|
# File 'lib/rack/cache/entitystore.rb', line 308
def open(key)
if data = read(key)
[data]
else
nil
end
end
|
#purge(key) ⇒ Object
323
324
325
326
|
# File 'lib/rack/cache/entitystore.rb', line 323
def purge(key)
cache.delete(key)
nil
end
|
#read(key) ⇒ Object
304
305
306
|
# File 'lib/rack/cache/entitystore.rb', line 304
def read(key)
cache.get(key)
end
|
#write(body) ⇒ Object
316
317
318
319
320
321
|
# File 'lib/rack/cache/entitystore.rb', line 316
def write(body)
buf = StringIO.new
key, size = slurp(body){|part| buf.write(part) }
cache.put(key, buf.string)
[key, size]
end
|