Method: ActiveSupport::Cache::RedisStore#write

Defined in:
lib/redis_store/cache/redis_store.rb

#write(key, value, options = nil) ⇒ Object

Write a value to the cache.

Possible options:

  • :unless_exist - set to true if you don’t want to update the cache if the key is already set.

  • :expires_in - the number of seconds that this value may stay in the cache. See ActiveSupport::Cache::Store#write for an example.



31
32
33
34
35
# File 'lib/redis_store/cache/redis_store.rb', line 31

def write(key, value, options = nil)
  super
  method = options && options[:unless_exist] ? :marshalled_setnx : :marshalled_set
  @data.send(method, key, value, options)
end