Method: Moneta::Adapters::Redis#load

Defined in:
lib/moneta/adapters/redis.rb

#load(key, options = {}) ⇒ Object

Fetch value with key. Return nil if the key doesn’t exist

Parameters:

  • key (Object)
  • options (Hash) (defaults to: {})

Options Hash (options):

  • :expires (Integer)

    Update expiration time (See Expires)

  • :raw (Boolean)

    Raw access without value transformation (See Transformer)

  • :prefix (String)

    Prefix key (See Transformer)

  • :sync (Boolean)

    Synchronized load (Cache reloads from adapter, Daybreak syncs with file)

  • Other (Object)

    options as defined by the adapters or middleware

Returns:

  • (Object)

    value



42
43
44
45
46
# File 'lib/moneta/adapters/redis.rb', line 42

def load(key, options = {})
  with_expiry_update(key, default: nil, **options) do |pipeline_handle|
    pipeline_handle.get(key)
  end
end