cacheieee is a lightweight, blazing-fast in-memory key-value data store written in C. Inspired by Redis, cacheieee provides essential caching capabilities and gives developers a behind-the-scenes look at how high-performance caching systems are built — from TCP networking and socket management to memory storage and command parsing.
- Basic key-value operations:
SET,GET,DEL,EXISTS - Key expiration with TTL support:
SETEX,TTL - Pattern matching for keys:
KEYS - Atomic integer operations:
INCR,DECR - Multi-client support using TCP sockets
- Tree-based key-value storage for efficient lookups (in progress)
- Clean command parsing for simplicity and efficiency
- Comprehensive CLI testing support
- Built from scratch in C for learning systems-level programming
| Command | Description |
|---|---|
SET key value |
Sets the value for the given key |
GET key |
Retrieves the value associated with the key |
DEL key |
Deletes the key and its value |
EXISTS key |
Checks if the key exists in the store |
KEYS pattern |
Returns all keys matching the given pattern (e.g., *, user*, etc.) |
SETEX key ttl value |
Sets a value with a TTL (in seconds) |
TTL key |
Returns the remaining time to live (TTL) for a key |
INCR key |
Increments an integer value by 1 |
DECR key |
Decrements an integer value by 1 |
PING |
Health check — responds with PONG |
FLUSHALL |
Deletes all keys in the current database (dangerous!) |
INFO |
Returns server stats (upcoming) |
QUIT |
Closes the client connection gracefully |
TREE |
Displays the current tree structure of the key value store |
- GCC or Clang compiler
- Make
- Linux/macOS (Windows is not officially supported)
- Clone the repository:
git clone https://github.com/mradulnatani/cacheieee.git
- Navigate into the project directory:
cd cacheieee - Build the project using
make:make
To start the cacheieee server, simply run the following command:
./cacheieeeThis will start the server on the default port 12049.
You can use tools like telnet, netcat (nc), or even your own client to connect to the server:
nc localhost 12049Once connected, you can issue the supported commands directly:
SET "name" "cacheieee"
GET name
SETEX "tempkey" 10 "hello"
TTL tempkeyHere are some features planned for future releases:
- Snapshot-based persistence (SAVE, LOAD)
- Eviction policies (LRU, LFU, etc.)
- Pub/Sub system
- Clustering and replication
- Role-based authentication
- Admin dashboard (via WebSocket + React?)
- Proper algorithm for LRU and other related stuff
Contributions, bug reports, and feature requests are welcome! Please feel free to fork the repository and submit a pull request.
MIT License
- Redis and CodeCrafters for the idea and inspiration
- Linux man pages for socket programming guidance
- C programming GOAT Dr. Jonas Brich
Made by Mradul
Project port: 12049 | Protocol: TCP
CacheMe if you can