cpp-redis-clone
A high-performance, Redis-inspired in-memory key-value store written in modern C++ — demonstrating real-world systems engineering skills including protocol parsing, concurrency, durability, and observability. This project replicates the core functionality of Redis and is ideal for exploring custom data stores, embedded caches, or distributed job queues.
Features
RESP Protocol - Full implementation of Redis Serialization Protocol (RESP) with parser/serializer built from scratch
Thread-Safe Operations - Concurrent command processing with Boost.Asio and mutex-protected memory operations
AOF Persistence - Append-Only File logging with automatic replay on startup
TTL Support - Key expiration with background cleanup thread
Prometheus Metrics - Real-time monitoring of commands, memory usage, connections, and errors
Memory Tracking - Precise byte-level memory usage monitoring
Python Test Client - Integration testing with raw socket communication
Unit Testing - Comprehensive test suite using Google Test framework
Architecture
Each client connection runs in its own thread
TTL cleanup runs in background thread
All operations update metrics and AOF in real-time
Memory usage tracked at byte precision
Thread-safe command processing
Supported Commands
SET key value - Set key to hold string valueGET key - Get value of keyDEL key - Delete keyEXPIRE key seconds - Set key expiration timeTTL key - Get time to live for keyPERSIST key - Remove expiration from keyMETRICS - Get Prometheus-compatible metricsQuick Start
Testing
Unit Tests
The project uses Google Test framework for comprehensive unit testing:
Store operations (SET, GET, DEL)
TTL and expiration handling
Memory usage tracking
Thread safety verification
AOF persistence
Example test output:
Integration Tests
The Python test client provides integration testing:
Full RESP protocol compliance
Command sequence verification
Metrics validation
Memory tracking accuracy
Metrics Example
Integration Test Output
Requirements
C++17
CMake 3.10+
Boost
Python 3
Google Test
0 likes · 16 views · Aug 16, 2025
Developed a Redis-inspired in-memory key-value store in C++.