Memorust

Introduction

What Memorust is, why it exists, and what it can do.

Memorust is a lightweight, single-binary, in-memory key-value database server written in Rust (edition 2024), with Tokio as its only dependency.

It speaks the RESP protocol, so it is compatible with redis-cli and existing Redis clients, and supports a subset of Redis commands with TTL and Append Only File (AOF) persistence.

Why does it exist?

Memorust began as a hands-on exploration of how an in-memory database works under the hood: async TCP networking, protocol design, concurrency, storage engines, persistence, and performance engineering.

The focus is on keeping the code simple and readable: a small, well-understood core that is easy to reason about and to extend toward broader Redis compatibility over time.

Feature overview

  • TCP server built on Tokio
  • RESP protocol support and redis-cli compatibility
  • In-memory key-value storage
  • TTL support with a background expiration cleaner
  • Append Only File (AOF) with a buffered writer
  • Periodic fsync (≈1s, appendfsync everysec style)
  • AOF replay on startup and AOF rewrite (compaction)
  • INFO and FLUSHALL commands
  • Concurrent client support, with concurrent reads under a shared lock

License

Memorust is dual-licensed under either the MIT license or the Apache License 2.0, at your option.

On this page