Skip to Content Skip to Search
Methods
L

Instance Public methods

load(payload)

# File activesupport/lib/active_support/cache.rb, line 849
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