Skip to main content

compress_payload

Function compress_payload 

Source
pub fn compress_payload(
    payload: Payload,
    config: &CompressionConfig,
    max_decompressed_bytes: usize,
) -> Result<CompressionWriteResult, ProtocolError>
Expand description

Compress when the payload meets the threshold and the marked result is strictly smaller than the escaped raw form.

Text payloads receive replacement UTF-8 conversion first, so the measured size is the stored text’s. The threshold comparison precedes the output cap: a value the read side would refuse is stored raw (write_over_limit) and subject to Redis’s own value limit instead. original_bytes is the payload’s own length and stored_bytes the length actually written.