Skip to main content

is_legacy_redis

Function is_legacy_redis 

Source
pub fn is_legacy_redis(bytes: &[u8]) -> bool
Expand description

Exact structural test for a 0.5.x Redis value.

The 0.5.x Redis value is bincode1(RedisRecord), which begins with the inner payload’s length as a little-endian u64 and is exactly payload_len + 24 bytes long. Every such value therefore satisfies the identity below, and it is used as a positive test for the legacy shape rather than relying on the magic prefix alone: a ~21 MB cached response could in principle begin with the magic bytes, and CachePolicy::max_body_size defaults to unbounded.