Class: AnyCache::Adapters::ActiveSupportNaiveStore::Expire Private
- Defined in:
- lib/any_cache/adapters/active_support_naive_store/expire.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Direct Known Subclasses
AnyCache::Adapters::ActiveSupportFileStore::Expire, AnyCache::Adapters::ActiveSupportMemoryStore::Expire
Constant Summary
Constants inherited from Operation
Operation::DEAD_TTL, Operation::NO_EXPIRATION_TTL, Operation::READ_MULTI_EMPTY_KEYS_SET
Instance Method Summary collapse
- #call(key, expires_in: DEAD_TTL) ⇒ void private
- #fetch_entry(key) ⇒ NilClass, ActiveSupport::Cache::Entry
Methods inherited from Operation
Constructor Details
This class inherits a constructor from AnyCache::Adapters::ActiveSupportNaiveStore::Operation
Instance Method Details
#call(key, expires_in: DEAD_TTL) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
13 14 15 16 17 18 19 |
# File 'lib/any_cache/adapters/active_support_naive_store/expire.rb', line 13 def call(key, expires_in: DEAD_TTL) fetch_entry(key).tap do |entry| next unless entry is_alive = expires_in.positive? is_alive ? write(key, entry.value, expires_in: expires_in) : delete(key) end end |
#fetch_entry(key) ⇒ NilClass, ActiveSupport::Cache::Entry
|
# File 'lib/any_cache/adapters/active_support_naive_store/expire.rb', line 21
|