instance method
write
Ruby on Rails 2.2.3
Since v2.2.3Signature
write(key, value, options = nil)
Writes the given value to the cache, with the given key.
You may also specify additional options via the options argument. The specific cache store implementation will decide what to do with options.
For example, MemCacheStore supports the :expires_in option, which tells the memcached server to automatically expire the cache item after a certain period:
cache = ActiveSupport::Cache::MemCacheStore.new cache.write("foo", "bar", :expires_in => 5.seconds) cache.read("foo") # => "bar" sleep(6) cache.read("foo") # => nil
Parameters
-
keyreq -
valuereq -
optionsopt = nil
Source
# File activesupport/lib/active_support/cache.rb, line 177
def write(key, value, options = nil)
log("write", key, options)
end
Defined in activesupport/lib/active_support/cache.rb line 177
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Cache::Store