This is a simple command line client for Memcached written in Python.
And it lets you interact with a Memcached server directly from your terminal, similar to how redis-cli works for Redis.
- ✅ Connect to a Memcached server
- ✅ Set and get key-value pairs
- ✅ Support for
add,replace,append, andprepend - ✅ Simple CLI with arguments for host/port
- ✅ Built to be extended (e.g., delete, increment/decrement, CAS)
- Python 3.10+
- A running Memcached server (default port:
11211)
On macOS (my current machine), you can install and run Memcached via Homebrew:
brew install memcached
brew services start memcachedOr run manually:
memcached -vv -p 11211Clone the repo and set up a virtual environment:
git clone https://github.com/alafilearnstocode/ccmc.git
cd ccmc
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtpython3 -m ccmc.cli [-H HOST] [-p PORT] <command> <key> [<value>]-H,--host: Memcached server hostname (default:localhost)-p,--port: Memcached server port (default:11211)
python3 -m ccmc.cli set mykey hello
# -> STORED
python3 -m ccmc.cli get mykey
# -> hello
python3 -m ccmc.cli add mykey hello
# -> NOT_STORED
python3 -m ccmc.cli replace mykey world
# -> STORED
python3 -m ccmc.cli append mykey !!!
# -> STORED
python3 -m ccmc.cli get mykey
# -> world!!!
python3 -m ccmc.cli prepend mykey Say:
# -> STORED
python3 -m ccmc.cli get mykey
# -> Say:world!!!
Here’s a live demo screenshot showing CCMC in action:
ccmc/
├── cli.py # Command line interface
├── client.py # Memcached client implementation
├── protocol.py # Protocol serialization/deserialization
└── __init__.py
- Add support for
delete - Add support for
incr/decr - Add support for
cas - Add test suite
