Expand description
Memcached text protocol parsing and reply framing.
Pure functions over bytes: no sockets, no state, and — importantly — no cache.
There is no map, no table, no store anywhere in this protocol. The model answers every
get. That is the project rule (protocols must not implement storage) and it is also the
entire point of running Memcached under NetGet: the interesting behaviour is a model
deciding what a key holds, not a hash map doing what hash maps do.
Scope is the text protocol, as advised: the binary protocol was deprecated in memcached
1.6 (2020) and is no longer documented in upstream protocol.txt.
Structs§
- Value
Item - One value in a
get/getsreply.
Enums§
- Command
- A parsed client command.
- Parse
Error - Why a line could not be turned into a
Command. - Parsed
- Result of trying to take one command off the front of a buffer.
Constants§
- MAX_
COMMAND_ LINE - Longest command line accepted before the connection is failed.
- MAX_
KEY_ LEN - Upstream memcached’s key limit (
KEY_MAX_LENGTH). - MAX_
VALUE_ LEN - Upstream memcached’s default item size limit (1 MiB), and this server’s declared
max_inbound_bytes.
Functions§
- encode_
stats - Frame a
statsreply:STAT <name> <value>\r\nper entry, thenEND\r\n. - encode_
values - Frame a retrieval reply.
- is_
noreply - Does this command suppress its reply when the client asked for
noreply? - parse_
command - Try to take one command from the front of
buffer. - retain_
requested_ values - Keep only the
VALUEblocks of a retrieval reply whose key the client asked for. - status_
line - Fixed status lines the text protocol defines.