method

dump_compressed

dump_compressed(entry, threshold)
public

No documentation available.

# File activesupport/lib/active_support/cache/coder.rb, line 20
      def dump_compressed(entry, threshold)
        return @serializer.dump_compressed(entry, threshold) if @legacy_serializer

        # If value is a string with a supported encoding, use it as the payload
        # instead of passing it through the serializer.
        if type = type_for_string(entry.value)
          payload = entry.value.b
        else
          type = OBJECT_DUMP_TYPE
          payload = @serializer.dump(entry.value)
        end

        if compressed = try_compress(payload, threshold)
          payload = compressed
          type = type | COMPRESSED_FLAG
        end

        expires_at = entry.expires_at || -1.0

        version = dump_version(entry.version) if entry.version
        version_length = version&.bytesize || -1

        packed = SIGNATURE.b
        packed << [type, expires_at, version_length].pack(PACKED_TEMPLATE)
        packed << version if version
        packed << payload
      end