Module: ActiveSupport::Cache::Coders::Loader

Extended by:
Loader
Included in:
Loader, Rails61Coder, Rails70Coder
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/cache.rb

Instance Method Summary collapse

Instance Method Details

#load(payload) ⇒ Object



854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/cache.rb', line 854

def load(payload)
  if !payload.is_a?(String)
    ActiveSupport::Cache::Store.logger&.warn %{Payload wasn't a string, was #{payload.class.name} - couldn't unmarshal, so returning nil."}

    return nil
  elsif payload.start_with?(MARK_70_UNCOMPRESSED)
    members = Marshal.load(payload.byteslice(1..-1))
  elsif payload.start_with?(MARK_70_COMPRESSED)
    members = Marshal.load(Zlib::Inflate.inflate(payload.byteslice(1..-1)))
  elsif payload.start_with?(MARK_61)
    return Marshal.load(payload)
  else
    ActiveSupport::Cache::Store.logger&.warn %{Invalid cache prefix: #{payload.byteslice(0).inspect}, expected "\\x00" or "\\x01"}

    return nil
  end
  Entry.unpack(members)
end