A lightweight, Redis-inspired in-memory key-value database implemented in Golang, featuring:
- Ultra-fast in-memory storage
RESP (Redis Serialization Protocol) support
AOF (Append-Only File) persistence
Custom command handling
Educational insight into Redis internals
This project highlights how modern in-memory databases work at their core and serves as a practical deep dive into networking, protocols, persistence, and storage engines.
All data is stored inside memory for extremely fast reads/writes.
Inspired by Redis’ architecture: minimal latency and straightforward data access.
The server implements RESP, the same protocol used by Redis.
This means:
- Structured command parsing
- Consistent response format
- Compatible with many Redis client behaviors
- Easy debugging & learning experience
RESP supports arrays, bulk strings, integers, errors, and simple strings — all handled in your server’s parser.
Instead of snapshotting (like Redis RDB), this project uses AOF persistence:
- Every write command (
SET,DEL, etc.) is appended to a log file - On restart, the database replays the file to rebuild the dataset
- Ensures durability while keeping the architecture simple and transparent
AOF makes it easy to understand how Redis ensures crash recovery.
| Command | Description |
|---|---|
PING |
Check server liveness |
SET key value |
Store a key-value pair |
GET key |
Retrieve the value of a key |
HSET key |
Sets a key-value pair but in a HashMap inside a HashMap |
HGET key |
Retrives the value of the key stored by HSET key. |
HGETALL key |
To Retreive all the values stored by a key by HSET. |
┌─────────────────────────┐
│ Redis Client │
│ (RESP-Compatible Tool) │
└───────────────▲─────────┘
│ RESP
│
┌─────────┴──────────┐
│ Go Server Core │
│ (Listener + Parser)|
└─────────▲──────────┘
│
┌──────────┴───────────┐
│ In-Memory Data Store│
└──────────▲───────────┘
│
┌─────────┴──────────┐
│ AOF Persistence │
│ (Append & Replay) │
└────────────────────┘
git clone https://github.com/AryanParashar24/Redis-inspired-InMemoryDatabase-in-Golang.git
cd Redis-inspired-InMemoryDatabase-in-GolangRun the Server
go run main.goConnect using redis-cli (optional)
redis-cli -p <PORT>Try:
PING
SET hello world
GET hello
DEL hello