Module: ActiveSupport::Cache::MongoCacheStore::Backend::TTL

Includes:
Base
Defined in:
lib/active_support/cache/mongo_cache_store/backend/ttl.rb

Overview

TTL

TTL backend for MongoCacheStore

Description

Entries are kept in a namespaced TTL collection that will automatically flush any entries as they pass their expiration time. This keeps the size of the cache in check over time.

Requires MongoDB 2.0 or higher

Additional Options

No additional options at this time

Instance Method Summary collapse

Methods included from Base

#decrement, #delete_matched, #increment, #read_multi

Instance Method Details

#clear(options = {}) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/active_support/cache/mongo_cache_store/backend/ttl.rb', line 28

def clear(options = {})
  col = get_collection(options) 
  ret = safe_rescue do
    col.remove
  end
  @collection = nil
  ret ? true : false
end