Class: ActiveSupport::Cache::Coder::LazyEntry
- Defined in:
- lib/active_support/cache/coder.rb
Instance Attribute Summary
Attributes inherited from Entry
Instance Method Summary collapse
-
#initialize(serializer, compressor, payload, **options) ⇒ LazyEntry
constructor
A new instance of LazyEntry.
- #mismatched?(version) ⇒ Boolean
- #value ⇒ Object
Methods inherited from Entry
#bytesize, #compressed, #compressed?, #dup_value!, #expired?, #expires_at, #expires_at=, #local?, #pack, unpack
Constructor Details
#initialize(serializer, compressor, payload, **options) ⇒ LazyEntry
Returns a new instance of LazyEntry.
99 100 101 102 103 104 |
# File 'lib/active_support/cache/coder.rb', line 99 def initialize(serializer, compressor, payload, **) super(payload, **) @serializer = serializer @compressor = compressor @resolved = false end |
Instance Method Details
#mismatched?(version) ⇒ Boolean
114 115 116 117 118 |
# File 'lib/active_support/cache/coder.rb', line 114 def mismatched?(version) super.tap { |mismatched| value if !mismatched } rescue Cache::DeserializationError true end |
#value ⇒ Object
106 107 108 109 110 111 112 |
# File '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 |