Awesome
<br> <p align="center"> <a href="https://shortishly.github.io/mcd/cover/"> <img alt="Test Coverage" src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fshortishly.github.io%2Fmcd%2Fcover%2Fcoverage.json&query=%24.total&suffix=%25&style=flat-square&label=Test%20Coverage&color=green"> </a> <a href="https://shortishly.github.io/mcd/ct/"> <img alt="Test Results" src="https://img.shields.io/badge/Tests-Common%20Test-green?style=flat-square"> </a> <a href="https://shortishly.github.io/mcd/edoc/"> <img alt="edoc" src="https://img.shields.io/badge/Documentation-edoc-green?style=flat-square"> </a> <a href="https://erlang.org/"> <img alt="Erlang/OTP 25+" src="https://img.shields.io/badge/Erlang%2FOTP-25%2B-green?style=flat-square"> </a> <a href="https://www.apache.org/licenses/LICENSE-2.0"> <img alt="Apache-2.0" src="https://img.shields.io/github/license/shortishly/mcd?style=flat-square"> </a> </p>What is MCD?
mcd is a memcached compatible API server written in Erlang/OTP 25 using ETS to maintain the cache of data.
It has a TCP memcached compatible API on port 11211 offering:
- the original text based standard protocol;
- the binary protocol;
- the text based meta protocol (which also deprecates the binary protocol).
Build
mcd uses erlang.mk with Erlang/OTP 25 to build:
make
Run
To run mcd with an Erlang Shell listening on port 11211:
make shell
Docker
To run mcd as a docker container:
docker run \
--pull always \
--detach \
--publish 11211:11211 \
--rm \
ghcr.io/shortishly/mcd:latest
API Example
The text based API is the easiest to try out from the command line with a simple set and get:
telnet localhost 11211
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
set foo 0 0 6
fooval
STORED
get foo
VALUE foo 0 6
fooval
END
The implementation uses some recently introduced features of Erlang/OTP:
- socket for all communication
- send_request for asynchronous request and response.
- the timeout feature of statem to expire items from the cache.