Minimal Redis-like key–value store with O(1) lookups, TTL, and append-only persistence (AOF). Concurrent TCP server using asyncio.
- Commands:
SET/GET/DEL/EXISTS/EXPIRE/TTL/INCR/KEYS/INFO/SAVE/FLUSHALL/SHUTDOWN - TTL expiration + background reaper
- AOF persistence with crash recovery
- Simple line protocol; test with
nc
python redis_mini/server.py --host 127.0.0.1 --port 6380 --data_dir ./data
printf "PING\nSET foo bar\nGET foo\nEXPIRE foo 5\nTTL foo\n" | nc 127.0.0.1 6380- Python 3.9+ (tested on 3.13)
- Fsync policy:
--aof_fsync=always | everysec | no SAVEwritesdata/dump.json