Method: ActiveSupport::Cache::Entry#initialize

Defined in:
lib/active_support/cache/entry.rb

#initialize(value, compressed: false, version: nil, expires_in: nil, expires_at: nil) ⇒ Entry

Creates a new cache entry for the specified value. Options supported are :compressed, :version, :expires_at and :expires_in.



25
26
27
28
29
30
31
# File 'lib/active_support/cache/entry.rb', line 25

def initialize(value, compressed: false, version: nil, expires_in: nil, expires_at: nil, **)
  @value      = value
  @version    = version
  @created_at = 0.0
  @expires_in = expires_at&.to_f || expires_in && (expires_in.to_f + Time.now.to_f)
  @compressed = true if compressed
end