Methods
public class
public instance
Attributes
cache | [R] | |
cache | [R] |
Public class methods
new
(options = {})
[show 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
new
(options = {})
[show 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
resolve
(uri)
[show source]
# File lib/rack/cache/entitystore.rb, line 328 328: def self.resolve(uri) 329: self.new(:namespace => uri.host) 330: end
resolve
(uri)
[show 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
exist?
(key)
[show source]
# File lib/rack/cache/entitystore.rb, line 300 300: def exist?(key) 301: cache.contains?(key) 302: end
open
(key)
[show 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
purge
(key)
[show source]
# File lib/rack/cache/entitystore.rb, line 323 323: def purge(key) 324: cache.delete(key) 325: nil 326: end
purge
(key)
[show 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
read
(key)
[show source]
# File lib/rack/cache/metastore.rb, line 383 383: def read(key) 384: key = hexdigest(key) 385: cache.get(key) || [] 386: end
read
(key)
[show source]
# File lib/rack/cache/entitystore.rb, line 304 304: def read(key) 305: cache.get(key) 306: end
write
(body)
[show 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
write
(key, entries)
[show 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