Class: Rack::Cache::AppEngine::MemCache

### Home Classes Methods

### In Files

- lib/rack/cache/appengine.rb

### Parent

Object

### Methods

- ::new
- #contains?
- #delete
- #get
- #namespace
- #namespace=
- #put

### Files

- CHANGES
- COPYING
- README
- TODO

### Class/Module Index

Quicksearch

- Rack
- Rack::Cache
- Rack::Cache::AppEngine
- Rack::Cache::AppEngine::MC
- Rack::Cache::AppEngine::MemCache
- Rack::Cache::CacheControl
- Rack::Cache::Context
- Rack::Cache::EntityStore
- Rack::Cache::EntityStore::DISK
- Rack::Cache::EntityStore::Dalli
- Rack::Cache::EntityStore::Disk
- Rack::Cache::EntityStore::FILE
- Rack::Cache::EntityStore::GAE
- Rack::Cache::EntityStore::GAECACHE
- Rack::Cache::EntityStore::GAEStore
- Rack::Cache::EntityStore::HEAP
- Rack::Cache::EntityStore::Heap
- Rack::Cache::EntityStore::MEM
- Rack::Cache::EntityStore::MemCacheBase
- Rack::Cache::EntityStore::MemCached
- Rack::Cache::Key
- Rack::Cache::MetaStore
- Rack::Cache::MetaStore::DISK
- Rack::Cache::MetaStore::Dalli
- Rack::Cache::MetaStore::Disk
- Rack::Cache::MetaStore::FILE
- Rack::Cache::MetaStore::GAE
- Rack::Cache::MetaStore::GAECACHE
- Rack::Cache::MetaStore::GAEStore
- Rack::Cache::MetaStore::HEAP
- Rack::Cache::MetaStore::Heap
- Rack::Cache::MetaStore::MEM
- Rack::Cache::MetaStore::MemCacheBase
- Rack::Cache::MetaStore::MemCached
- Rack::Cache::Options
- Rack::Cache::Request
- Rack::Cache::Response
- Rack::Cache::Storage

No matching classes.

# Rack::Cache::AppEngine::MemCache

### Public Class Methods

new(options = {}) click to toggle source

    # File lib/rack/cache/appengine.rb, line 18
    def initialize(options = {})
      @cache = MC::Service
      @cache.namespace = options[:namespace] if options[:namespace]
    end

### Public Instance Methods

contains?(key) click to toggle source

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

delete(key) click to toggle source

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

get(key) click to toggle source

    # File lib/rack/cache/appengine.rb, line 27
    def get(key)
      value = MC::Service.get(key)
      Marshal.load(Base64.decode64(value)) if value
    end

namespace() click to toggle source

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

namespace=(value) click to toggle source

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

put(key, value, ttl = nil) click to toggle source

    # 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.