KiloDB is a high-performance, Redis-compatible key-value database written in Rust. It implements the Redis protocol (RESP) and provides a subset of Redis commands, making it a lightweight alternative for applications that need Redis-like functionality.
- Strings: SET, GET, DEL, EXISTS, INCR, DECR, APPEND, STRLEN, MGET, MSET
- Hashes: HSET, HGET, HGETALL, HDEL, HEXISTS, HLEN, HKEYS, HVALS
- Lists: LPUSH, RPUSH, LPOP, RPOP, LLEN, LRANGE, LINDEX
- Sets: SADD, SREM, SMEMBERS, SISMEMBER, SCARD, SUNION, SINTER
- Key Management: KEYS, TYPE, TTL, EXPIRE, PERSIST, RENAME
- Single-threaded architecture for predictable performance
- In-memory storage with fast access patterns
- RESP protocol implementation for Redis client compatibility
- Efficient data structures optimized for Rust
- Redis Protocol (RESP) - Compatible with existing Redis clients
- TCP server listening on standard Redis port (6379)
- Connection handling with proper client lifecycle management
- Rust 1.70+ (Install Rust)
-
Clone the repository
git clone https://github.com/madhavkhoslaa/KiloDB.git cd KiloDB
-
Build the project
cargo build --release
-
Run KiloDB
cargo run --release
-
Connect with Redis client
redis-cli -p 6379
# Start KiloDB server
cargo run
# In another terminal, connect with redis-cli
redis-cli -p 6379
## 🛠️ Development
### Building
```bash
# Debug build
cargo build
# Release build
cargo build --release
# Run tests
cargo test
# Check code quality
cargo clippy
- Add the command to
src/command/command_enum.rs
- Implement execution logic in
src/command/executor/
- Add tests in
tests/
directory
- ✅ Implement core Redis commands and data structures
- ✅ Basic RESP protocol support
- ✅ TCP server implementation
- TTL (Time To Live) support
- Cache eviction mechanisms (LRU, LFU)
- Memory usage optimization
- Async/await implementation
- Multi-threading support
- Improved connection handling
- Race condition elimination
- Mutex poisoning prevention
- Production-ready stability