Module: ActiveSupport::Cache::MongoCacheStore::Backend::Capped

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

Overview

Capped

Experimental

Capped backend for MongoCacheStore

Description

Experimental do not use… yet.

This should only be used if limiting the size of the cache is of great concern. Entries are flushed from the cache on a FIFO basis, regardless of the entries expiration time.

Delete operations set an entry to expired, but it will not be flushed until it is automatically removed by MongoDB.

Options

TODO

Instance Method Summary collapse

Methods included from Base

#decrement, #delete_matched, #increment, #read_multi

Instance Method Details

#clear(options = {}) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/active_support/cache/mongo_cache_store/backend/capped.rb', line 31

def clear(options = {})
  col = get_collection(options) 
  ret = safe_rescue do
    col.update({},{:expires_at => Time.new})
  end
  ret ? true : false
end