Public class methods
new
(options = {})
[show source]
# File lib/rack/cache/appengine.rb, line 18 18: def initialize(options = {}) 19: @cache = MC::Service 20: @cache.namespace = options[:namespace] if options[:namespace] 21: end
Public instance methods
contains?
(key)
[show source]
# File lib/rack/cache/appengine.rb, line 23 23: def contains?(key) 24: MC::Service.contains(key) 25: end
delete
(key)
[show source]
# File lib/rack/cache/appengine.rb, line 46 46: def delete(key) 47: MC::Service.delete(key) 48: end
get
(key)
[show source]
# File lib/rack/cache/appengine.rb, line 27 27: def get(key) 28: value = MC::Service.get(key) 29: Marshal.load(Base64.decode64(value)) if value 30: end
namespace
()
[show source]
# File lib/rack/cache/appengine.rb, line 38 38: def namespace 39: MC::Service.getNamespace 40: end
namespace=
(value)
[show source]
# File lib/rack/cache/appengine.rb, line 42 42: def namespace=(value) 43: MC::Service.setNamespace(value.to_s) 44: end
put
(key, value, ttl = nil)
[show source]
# File lib/rack/cache/appengine.rb, line 32 32: def put(key, value, ttl = nil) 33: expiration = ttl ? MC::Expiration.byDeltaSeconds(ttl) : nil 34: value = Base64.encode64(Marshal.dump(value)).gsub(/\n/, '') 35: MC::Service.put(key, value, expiration) 36: end