Memora is a lightweight, Redis-inspired in-memory data store built for learning, experimentation, and developer-focused caching. It implements a subset of Redis semantics with a strong emphasis on correct behavior, clean architecture, and protocol compatibility.
This project is intentionally designed to explore how Redis works internally — not just at the command level, but across networking, persistence, expiry, and tooling.
- RESP2 protocol compatible (works with redis-cli-style clients)
- In-memory key-value store
- String, List, and Hash data types
- TTL with lazy + active expiry
- Accurate Redis-style error semantics
- Append-Only File (AOF) persistence
- Safe AOF replay on startup
- Background AOF rewrite (compaction)
- Async TCP server
- Concurrent clients
- Graceful shutdown
- Structured logging
- Interactive REPL mode
- One-shot command execution
- Command history & autocomplete
- Redis-like output formatting
┌────────────┐ RESP ┌──────────────┐
│ Memora │◀────────────▶│ CLI │
│ Server │ └──────────────┘
│ │
│ ┌──────┐ │ ┌──────────────┐
│ │ RESP │◀─┼──────────────▶│ Clients │
│ │ I/O │ │ └──────────────┘
│ └──────┘ │
│ │ │
│ ┌──────────────┐
│ │ InMemoryStore│
│ │ + TTL │
│ │ + AOF │
│ └──────────────┘
└────────────┘
Each layer is isolated:
- Protocol knows nothing about storage
- Storage knows nothing about networking
- CLI uses the protocol, not shortcuts
SET,GET,DEL,EXISTSINCR,INCRBY
EXPIRE,PEXPIRETTL,PTTL
LPUSH,RPUSHLPOP,RPOPLLEN
HSET,HGET,HDELHLEN,HKEYS,HVALS
INFOCONFIG GETFLUSHDB,FLUSHALL
Memora uses an Append-Only File (AOF) similar to Redis:
- Every mutating command is appended in RESP format
- On startup, the AOF is replayed to reconstruct state
- Background AOF rewrite compacts the log
- Rewrite skips expired keys and replays logical state
This provides durability while keeping the implementation approachable.
dotnet run --project Memora.Serverdotnet run --project Memora.CliOr execute a single command:
dotnet run --project Memora.Cli SET foo bar- Correct Redis-like behavior over raw performance
- Clear separation of concerns
- Learn-by-building internal systems
- Easy to extend (new commands, eviction, replication)
- Eviction policies (LRU / LFU)
- Max memory limits
- Snapshot (RDB-lite) persistence
- Replication (master/replica)
- Benchmarks vs Redis
Memora exists to answer one question:
How does Redis actually work under the hood?
On Microsoft Windows, setting up Redis for development often requires Docker or WSL.
- Download release
- Run memora-server.exe
- Start developing immediately
No containers or external services required.
- Local development
- Integration testing
- Prototyping
- Lightweight production usage
Memora is not intended to fully replace Redis for high-scale production. It implements a compatible wire protocol for development purposes.
MIT License