Skip to main content

Module protocol

Module protocol 

Source
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§

ValueItem
One value in a get/gets reply.

Enums§

Command
A parsed client command.
ParseError
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 stats reply: STAT <name> <value>\r\n per entry, then END\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 VALUE blocks of a retrieval reply whose key the client asked for.
status_line
Fixed status lines the text protocol defines.