VoltKV-Go is a lightweight, Redis-inspired in-memory key-value data store, implemented in Go. It is designed to mimic some of the core features of Redis, focusing on understanding how key-value stores work and how data is serialized and communicated using the Redis Serialization Protocol (RESP).
The server accepts connections over TCP and processes incoming RESP-formatted messages, executing commands. It is designed to help understand the internals of systems like Redis by re-creating them from scratch in a modular and extensible manner.
- Custom RESP protocol parser
- In-memory key-value store
- Key expiration support
- Handles multiple clients over TCP
- Basic Redis-like commands
git clone https://github.com/Shivanipalya26/VoltKV-Go.git
cd VoltKV-GoMake sure Go is installed. If not, download it from golang.org.
go versiongo run main.goBy default, the server starts on port 6379.
├── main.go # Entry point: starts the server
├── server/ # Connection handling
├── internals/
├── resp/ # RESP parsing & RESP encoder utilities
├── store/ # In-memory key-value store & expiration logic
├── cmd/ # Command executor logicUse redis-cli in Docker or a Redis client to test the server:
docker run -it --rm redis redis-cli -h <your-host-ip> -p 6379Then type:
PING
→ PONG
SET mykey "Hello"
→ OK
GET mykey
→ "Hello"
DEL mykey
→ (integer) 1
EXISTS mykey
→ (integer) 0| Command | Description |
|---|---|
PING [msg] |
Responds with PONG or msg |
SET <k> <v> |
Sets a key-value pair |
GET <k> |
Gets the value for the key |
DEL <k1> |
Deletes key |
MSET k1 v1.. |
Sets multiple keys |
MGET k1 k2.. |
Gets multiple keys |
HSET <k> <f> <v> |
Sets a field in a hash |
HGET <k> <field> |
Gets the value of a field in a hash |
HGETALL <k> |
Returns all fields and values of a hash |
EXPIRE <k> <sec> |
Set TTL for a key |
EXISTS <k> |
Checks if the key exists |
LPUSH <k> <v1>.. |
Pushes one or more values to the left |
RPUSH <k> <v1>.. |
Pushes one or more values to the right |
LPOP <k> |
Removes and returns the first element |
RPOP <k> |
Removes and returns the last element |
Feel free to fork the repo and submit pull requests!
This project is made for learning and experimentation.