How honey-singh716/miniredis works
MiniRedis is a command-line, in-memory key-value store. A user enters commands in the interactive CLI; the parser validates and dispatches them to RedisStore, which coordinates the hash table, LRU cache, TTL scheduling, and persistence. TTL operations use absolute expiry times and version checks to avoid stale expirations; SAVE and LOAD preserve expiry timestamps across restarts. The README documents the broader command and persistence capabilities; relationships not visible in sampled source are included only where documented. The map focuses on runtime components, not benchmarks or tests.
Main entry points: RedisStore.cpp RedisStore · main.cpp Interactive CLI · CommandParser.cpp Command Parser · TTLManager.cpp TTL Manager
Components 11
Command Interface
- Interactive CLI
main.cpp - Command Parser
src/CommandParser.cpp
Store Coordination
- RedisStore
src/RedisStore.cpp - Expiry and Version Maps
src/RedisStore.cpp - TTL Manager
src/TTLManager.cpp
Storage Structures
- Hash Table
src/HashTable.cpp - LRU Cache
src/LRUCache.cpp - Expiry Min-Heap
include/TTLManager.h
Persistence
- Persistence
src/Persistence.cpp - Database File
miniredis.db
Other components
- User
Connections 10
- User → Interactive CLI: enters commands
README.md - Interactive CLI → Command Parser: tokenizes and dispatches
main.cpp - Command Parser → RedisStore: dispatches operations
src/CommandParser.cpp - RedisStore → Hash Table: reads and writes
src/RedisStore.cpp - RedisStore → LRU Cache: checks and updates
src/RedisStore.cpp - RedisStore → TTL Manager: schedules expirations
src/RedisStore.cpp - RedisStore → Expiry and Version Maps: tracks expiry versions
src/RedisStore.cpp - TTL Manager → Expiry Min-Heap: adds and removes
src/TTLManager.cpp - RedisStore → Persistence: saves and loads
src/RedisStore.cpp - Persistence → Database File: reads and writes
README.md