class method
self.new
Ruby on Rails 3.2.22.5
Since v3.0.20 Last seen in v3.2.22.5Signature
self.new(value, options = {})
Create a new cache entry for the specified value. Options supported are :compress, :compress_threshold, and :expires_in.
Parameters
-
valuereq -
optionsopt = {}
Source
# File activesupport/lib/active_support/cache.rb, line 553
def initialize(value, options = {})
@compressed = false
@expires_in = options[:expires_in]
@expires_in = @expires_in.to_f if @expires_in
@created_at = Time.now.to_f
if value.nil?
@value = nil
else
@value = Marshal.dump(value)
if should_compress?(@value, options)
@value = Zlib::Deflate.deflate(@value)
@compressed = true
end
end
end
Defined in activesupport/lib/active_support/cache.rb line 553
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Cache::Entry