Method: CloudConfig::Cache::Redis#set

Defined in:
lib/cloud-config/cache/redis.rb

#set(key, value, options = {}) ⇒ Object

Set the value of the key in the cache. Optionally set an expiry of the key, otherwise a default expiry of DEFAULT_EXPIRE will be set.

Parameters:

  • key (String, Symbol)

    Key to set

  • value (Object)

    Value of the key

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

    a customizable set of options

Options Hash (options):

  • :expire_in (Hash)

    Time in seconds until key expires



52
53
54
# File 'lib/cloud-config/cache/redis.rb', line 52

def set(key, value, options = {})
  client.set(key, value, ex: options[:expire_in] || DEFAULT_EXPIRE)
end