Skip to main content

encode_values

Function encode_values 

Source
pub fn encode_values(items: &[ValueItem], include_cas: bool) -> Vec<u8> ⓘ
Expand description

Frame a retrieval reply.

VALUE <key> <flags> <bytes> [<cas unique>]\r\n
<data block>\r\n
...
END\r\n

<bytes> is computed here from the actual payload length. It is never taken from the model: a byte count that disagrees with the payload desynchronises the client’s parser for the rest of the connection, and a model asked to count bytes will eventually miscount. An empty item list is a cache miss, which is END\r\n alone.