instance method
value
Ruby on Rails 3.2.22.5
Since v3.0.20 Last seen in v3.2.22.5Signature
value()
Get the value stored in the cache.
Source
# File activesupport/lib/active_support/cache.rb, line 575
def value
# If the original value was exactly false @value is still true because
# it is marshalled and eventually compressed. Both operations yield
# strings.
if @value
# In rails 3.1 and earlier values in entries did not marshaled without
# options[:compress] and if it's Numeric.
# But after commit a263f377978fc07515b42808ebc1f7894fafaa3a
# all values in entries are marshalled. And after that code below expects
# that all values in entries will be marshaled (and will be strings).
# So here we need a check for old ones.
begin
Marshal.load(compressed? ? Zlib::Inflate.inflate(@value) : @value)
rescue TypeError
compressed? ? Zlib::Inflate.inflate(@value) : @value
end
end
end
Defined in activesupport/lib/active_support/cache.rb line 575
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Cache::Entry