Class: AnyCache::Adapters::ActiveSupportNaiveStore::Persist Private

Inherits:
Operation
  • Object
show all
Defined in:
lib/any_cache/adapters/active_support_naive_store/persist.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.

Since:

  • 0.1.0

Constant Summary

Constants inherited from Operation

Operation::DEAD_TTL, Operation::NO_EXPIRATION_TTL, Operation::READ_MULTI_EMPTY_KEYS_SET

Instance Method Summary collapse

Methods inherited from Operation

#initialize

Constructor Details

This class inherits a constructor from AnyCache::Adapters::ActiveSupportNaiveStore::Operation

Instance Method Details

#call(key) ⇒ 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.

Parameters:

  • key (String)

Since:

  • 0.1.0



12
13
14
15
16
# File 'lib/any_cache/adapters/active_support_naive_store/persist.rb', line 12

def call(key)
  fetch_entry(key).tap do |entry|
    write(key, entry.value, expires_in: NO_EXPIRATION_TTL) if entry
  end
end

#fetch_entry(key) ⇒ NilClass, ActiveSupport::Cache::Entry

Parameters:

  • key (String)

Returns:

  • (NilClass, ActiveSupport::Cache::Entry)


# File 'lib/any_cache/adapters/active_support_naive_store/persist.rb', line 18