██████ ███████ ██████ ██ ██████ ██████
██ ██ ██ ██ ██ ██ ██ ██ ██
██████ █████ ██ ██ ██ ██ ███ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ███████ ██████ ██ ██████ ██████
⚡ A Redis-like multithread in-memory datastore built in Go from scratch ⚡
This project is a from-scratch implementation of a Redis-like in-memory data store written in Go, focusing on I/O Model, RESP protocol, core commands, data structures, caching, and concurrency model.
- CLI:
- Go 1.24+
- (Optional) Docker or Podman for containerized deployment
git clone https://github.com/spaghetti-lover/RediGo.git- Run CLI
go mod tidy
go run cmd/main.go- Run with Docker-compose
make dev- Run with Docker (single container), useful for deployment
make deployredis-cli -p 6379./redis/src/redis-benchmark -p 3000 -t set -n 1000000 -r 1000000
./redis/src/redis-benchmark -n 1000000 -t get -c 500 -h localhost -p 3000 -r 1000000 --threads 3-
⚡ Server models: Simple TCP server, Thread Pool, One thread per connection, I/O multiplexing (
epoll,kqueue), Shared-nothing architecture -
🔗 Protocol: Redis Serialization Protocol (RESP)
-
🛠️ Core Commands:
- Hash Map:
GET,SET,TTL,DEL, auto key expiration - Simple Set:
SADD,SREM,SMEMBERS,SISMEMBER - Sorted Set:
ZADD,ZSCORE,ZRANK(with both skip list and B+ Tree) - Count-min Sketch:
CMS.INCRBY,CMS.QUERY,CMS.INITBYDIM - Bloom Filter:
BF.ADD,BF.EXISTS,BF.RESERVE
- Hash Map:
-
🔑 Passive, Active expired key deletion
-
🧹 Caching: Random, approximated LRU, approximated LFU
-
🧵 Graceful shutdown and connection handling
- Implement server model io_uring (Linux)
- Geospatial
- List
- Bitmap
- HyperLogLog
- Queue
- Pipeline
- Authentication
- Persistence: RDB, AOF