Class Rack::Cache::AppEngine::MemCache
In: lib/rack/cache/appengine.rb
Parent: Object

Methods

contains?   delete   get   namespace   namespace=   new   put  

Public Class methods

[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

[Source]

    # File lib/rack/cache/appengine.rb, line 23
23:       def contains?(key)
24:         MC::Service.contains(key)
25:       end

[Source]

    # File lib/rack/cache/appengine.rb, line 46
46:       def delete(key)
47:         MC::Service.delete(key)
48:       end

[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

[Source]

    # File lib/rack/cache/appengine.rb, line 38
38:       def namespace
39:         MC::Service.getNamespace
40:       end

[Source]

    # File lib/rack/cache/appengine.rb, line 42
42:       def namespace=(value)
43:         MC::Service.setNamespace(value.to_s)
44:       end

[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

[Validate]