123456789_123456789_123456789_123456789_123456789_

Class: ActiveSupport::Cache::Coder::LazyEntry

Relationships & Source Files
Inherits: ActiveSupport::Cache::Entry
  • ::Object
Defined in: activesupport/lib/active_support/cache/coder.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(serializer, compressor, payload, **options) ⇒ LazyEntry

[ GitHub ]

  
# File 'activesupport/lib/active_support/cache/coder.rb', line 99

def initialize(serializer, compressor, payload, **options)
  super(payload, **options)
  @serializer = serializer
  @compressor = compressor
  @resolved = false
end

Instance Method Details

#mismatched?(version) ⇒ Boolean

[ GitHub ]

  
# File 'activesupport/lib/active_support/cache/coder.rb', line 114

def mismatched?(version)
  super.tap { |mismatched| value if !mismatched }
rescue Cache::DeserializationError
  true
end

#value

[ GitHub ]

  
# File 'activesupport/lib/active_support/cache/coder.rb', line 106

def value
  if !@resolved
    @value = @serializer.load(@compressor ? @compressor.inflate(@value) : @value)
    @resolved = true
  end
  @value
end