Skip to content

alafilearnstocode/ccmc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CCMC: Command Line Memcached Client

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.

Features

  • ✅ Connect to a Memcached server
  • ✅ Set and get key-value pairs
  • ✅ Support for add, replace, append, and prepend
  • ✅ Simple CLI with arguments for host/port
  • ✅ Built to be extended (e.g., delete, increment/decrement, CAS)

Requirements

  • 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 memcached

Or run manually:

memcached -vv -p 11211

Installation

Clone 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.txt

Usage

General format

python3 -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!!!

Demo

Here’s a live demo screenshot showing CCMC in action:

Demo Screenshot

Project Structure

ccmc/
 ├── cli.py         # Command line interface
 ├── client.py      # Memcached client implementation
 ├── protocol.py    # Protocol serialization/deserialization
 └── __init__.py

Roadmap

  • Add support for delete
  • Add support for incr / decr
  • Add support for cas
  • Add test suite

About

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.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages