instance method load

Ruby on Rails 7.0.10

Since v7.0.10 Last seen in v7.0.10

Signature

load(payload)

No documentation comment.

Parameters

payload req
Source
# File activesupport/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

Defined in activesupport/lib/active_support/cache.rb line 854 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::Cache::Coders::Loader

Type at least 2 characters to search.

↑↓ navigate · open · esc close