How roh355/nanocache works
This repository implements a small RESP-speaking in-memory key/value cache server. A client sends a command over TCP; the server parses it, dispatches it to command handlers, and returns an encoded response. The cache supports expiration, while snapshots restore state at startup and save it during shutdown. The sampled server and command sources show these calls directly; no README is available, so the graph reflects the capabilities visible in the source rather than undocumented features.
Main entry points: server.cpp Server loop · commands.cpp Command dispatcher · snapshot.cpp Snapshot persistence · resp_parser.cpp RESP parser and encoder
Components 7
TCP server
- Server loop
server.cpp
Command protocol
- RESP parser and encoder
resp_parser.cpp - Command dispatcher
commands.cpp
Cache storage
- TTL cache
cache.cpp - Snapshot persistence
snapshot.cpp
Other components
- TCP client
- Snapshot file
Connections 8
- TCP client → Server loop: sends commands
server.cpp - Server loop → TCP client: sends responses
server.cpp - Server loop → RESP parser and encoder: parses input
server.cpp - Server loop → Command dispatcher: dispatches commands
server.cpp - Command dispatcher → TTL cache: reads and writes
commands.cpp - Command dispatcher → RESP parser and encoder: encodes replies
commands.cpp - Server loop → Snapshot persistence: loads and saves
server.cpp - Snapshot persistence → Snapshot file: reads and writes
snapshot.cpp