instance method
fetch
Ruby on Rails 2.3.18
Since v2.3.18 Last seen in v2.3.18Signature
fetch(key, expiry = 0, raw = false)
Performs a get with the given key. If the value does not exist and a block was given, the block will be called and the result saved via add.
If you do not provide a block, using this method is the same as using get.
Parameters
-
keyreq -
expiryopt = 0 -
rawopt = false
Source
# File activesupport/lib/active_support/vendor/memcache-client-1.7.4/memcache.rb, line 226
def fetch(key, expiry = 0, raw = false)
value = get(key, raw)
if value.nil? && block_given?
value = yield
add(key, value, expiry, raw)
end
value
end
Defined in activesupport/lib/active_support/vendor/memcache-client-1.7.4/memcache.rb line 226
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in MemCache