Class: ActiveSupport::Cache::DalliStoreWithSaneTtl

Inherits:
DalliStore
  • Object
show all
Includes:
Concerns::SaneMemcachedTtlHelper
Defined in:
lib/active_support/cache/dalli_store_with_sane_ttl.rb

Constant Summary

Constants included from SaneMemcachedTtl::Utils

SaneMemcachedTtl::Utils::MEMCACHED_MAX_TTL

Instance Method Summary collapse

Methods included from Concerns::SaneMemcachedTtlHelper

#extract_large_default_ttl!, #sanitize_ttl_options!

Methods included from SaneMemcachedTtl::Utils

#is_large_ttl?, #sanitize_ttl, #ttl_to_timestamp

Constructor Details

#initialize(*addresses) ⇒ DalliStoreWithSaneTtl

Returns a new instance of DalliStoreWithSaneTtl.



12
13
14
15
16
17
# File 'lib/active_support/cache/dalli_store_with_sane_ttl.rb', line 12

def initialize(*addresses)
  addresses = addresses.flatten
  options = addresses.extract_options!
  extract_large_default_ttl! options, [:expires_in]
  super addresses, options
end

Instance Method Details

#decrement(name, amount = 1, options = nil) ⇒ Object



25
26
27
28
29
# File 'lib/active_support/cache/dalli_store_with_sane_ttl.rb', line 25

def decrement(name, amount = 1, options = nil)
  options = options || {}
  sanitize_ttl_options! options, [:expires_in], :expires_in
  super name, amount, options
end

#increment(name, amount = 1, options = nil) ⇒ Object



19
20
21
22
23
# File 'lib/active_support/cache/dalli_store_with_sane_ttl.rb', line 19

def increment(name, amount = 1, options = nil)
  options = options || {}
  sanitize_ttl_options! options, [:expires_in], :expires_in
  super name, amount, options
end