Module: ActiveSupport::Cache::Concerns::SaneMemcachedTtlHelper

Extended by:
ActiveSupport::Concern
Includes:
SaneMemcachedTtl::Utils
Included in:
ActiveSupport::Cache::CouchbaseStoreWithSaneTtl, DalliStoreWithSaneTtl, MemCacheStoreWithSaneTtl
Defined in:
lib/active_support/cache/concerns/sane_memcached_ttl_helper.rb

Constant Summary

Constants included from SaneMemcachedTtl::Utils

SaneMemcachedTtl::Utils::MEMCACHED_MAX_TTL

Instance Method Summary collapse

Methods included from SaneMemcachedTtl::Utils

#is_large_ttl?, #sanitize_ttl, #ttl_to_timestamp

Instance Method Details

#extract_large_default_ttl!(options, insane_options) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/active_support/cache/concerns/sane_memcached_ttl_helper.rb', line 14

def extract_large_default_ttl!(options, insane_options)
  ttl = options[insane_options.find { |option| options[option] != nil }]

  if ttl.present? && is_large_ttl?(ttl)
    insane_options.each { |option| options.delete option }
    self.large_default_ttl = ttl
  end
end

#sanitize_ttl_options!(options, insane_options, default_option) ⇒ Object



23
24
25
26
27
28
# File 'lib/active_support/cache/concerns/sane_memcached_ttl_helper.rb', line 23

def sanitize_ttl_options!(options, insane_options, default_option)
  ttl = options[insane_options.find { |option| options[option] != nil }]

  insane_options.each { |option| options.delete(option) }
  options[default_option] = sanitize_ttl(ttl || large_default_ttl)
end