SYSTEMS PROGRAMMING
Torus
A small in-memory key-value server in C++17, built to learn how data stores and TCP servers work.
What it does
Torus is a command-line key-value server written in C++17. It stores values in memory and accepts commands such as SET, GET, EXISTS, and REMOVE over TCP. Keys can also have a time to live, so they expire when they are next accessed.
How it works
The server reads newline-delimited commands and handles each client connection on its own thread. The code separates networking, command parsing, command execution, and storage. A mutex protects the shared store while clients work at the same time.
What I’m learning
I’m building Torus step by step to understand how a data server works under the hood. The next parts I want to explore include saving data to disk, recovering it after a restart, and limiting memory use.
Links
- Source code: github.com/anuptiwari17/torus