README.md
1# Minimal (C) Client for MemCached
2
3WARNING: WORK IN PROGRESS. Missing features or testing!
4
5MCMC is a minimalistic allocation-free modern client for memcached. It uses a
6generic response parser, allowing a single code path regardless of the command
7sent to memcached. It has no 3rd party dependencies and is designed to
8integrate as a building block into full clients.
9
10MCMC does not (yet) include a typical memcached "selector". Meaning the
11ability to add many servers to a hash table of some kind and routing keys to
12specific servers. The MCMC base client is designed to be an object that
13selector objects hold and then issue commands against.
14
15Allocation-free (aside from a call to `getaddrinfo()`) means it does not
16_internally_ do any allocations, relying only on the stack. It requires you
17malloc a small structure and some buffers, but you are then free to manage
18them yourselves. Clients do not hold onto buffers when idle, cutting their
19memory overhead to a handful of bytes plus the TCP socket.
20
21MCMC is designed to be a building block for users designing full clients.
22For example:
23
24* A client author wants to implement the "get" command
25* They write a function in their native language's wrapper which accepts the
26 key to fetch and embeds that into a text buffer to look like `get [key]\r\n`
27* They then call mcmc's functions to send and read the response, parsing and
28 returning it to the client.
29
30This should be the same, if not less, code than wrapping a full C client with
31every possible command broken out. It also means 3rd party clients can (and
32should!) embed mcmc.c/mcmc.h (and any selector code they want) rather than be
33dependent on system distribution of a more complex client.
34
35The allocation-free nature also makes unit testing the client code easier,
36hopefully leading to higher quality.
37
38Caveats:
39
40* Care should be taken when handling the buffers mcmc requires to operate.
41 Since there are few operators you should only have to pay attention once :)
42* It does not support the various maintenance/settings commands (ie; `lru_crawler`).
43 It may gain some generic support for this, but those commands were not
44designed with consistent response codes and are hard to implement.
45* Does not support the binary protocol, which has been deprecated as of 1.6.0.
46
47As of this writing the code is being released _early_ (perhaps too early?). It
48may not have proper makefiles, tests, or a fully implemented API. The code has
49been posted so client authors and users can give early feedback on the API in
50hopes of prodiving something high quality and stable.
51
52Again, looking for feedback! Open an issue or let me know what you think.
53