# File lib/rack/cache/appengine.rb, line 18 def initialize(options = {}) @cache = MC::Service @cache.namespace = options[:namespace] if options[:namespace] end
# File lib/rack/cache/appengine.rb, line 23 def contains?(key) MC::Service.contains(key) end
# File lib/rack/cache/appengine.rb, line 46 def delete(key) MC::Service.delete(key) end
# File lib/rack/cache/appengine.rb, line 27 def get(key) value = MC::Service.get(key) Marshal.load(Base64.decode64(value)) if value end
# File lib/rack/cache/appengine.rb, line 38 def namespace MC::Service.getNamespace end
# File lib/rack/cache/appengine.rb, line 42 def namespace=(value) MC::Service.setNamespace(value.to_s) end
# File lib/rack/cache/appengine.rb, line 32 def put(key, value, ttl = nil) expiration = ttl ? MC::Expiration.byDeltaSeconds(ttl) : nil value = Base64.encode64(Marshal.dump(value)).gsub(/\n/, '') MC::Service.put(key, value, expiration) end