class Rack::Cache::AppEngine::MemCache
Public Class Methods
Source
# File lib/rack/cache/app_engine.rb 16 def initialize(options = {}) 17 @cache = MC::Service 18 @cache.namespace = options[:namespace] if options[:namespace] 19 end
Public Instance Methods
Source
# File lib/rack/cache/app_engine.rb 21 def contains?(key) 22 MC::Service.contains(key) 23 end
Source
# File lib/rack/cache/app_engine.rb 44 def delete(key) 45 MC::Service.delete(key) 46 end
Source
# File lib/rack/cache/app_engine.rb 25 def get(key) 26 value = MC::Service.get(key) 27 Marshal.load(Base64.decode64(value)) if value 28 end
Source
# File lib/rack/cache/app_engine.rb 36 def namespace 37 MC::Service.getNamespace 38 end
Source
# File lib/rack/cache/app_engine.rb 40 def namespace=(value) 41 MC::Service.setNamespace(value.to_s) 42 end
Source
# File lib/rack/cache/app_engine.rb 30 def put(key, value, ttl = nil) 31 expiration = ttl ? MC::Expiration.byDeltaSeconds(ttl) : nil 32 value = Base64.encode64(Marshal.dump(value)).gsub(/\n/, '') 33 MC::Service.put(key, value, expiration) 34 end