Skip to main content

RadishDB

RadishDB is a Redis-inspired, in-memory key-value database written in C. It implements real storage engine internals — write-ahead logging, crash recovery, TTL expiration, log compaction, binary snapshots, and a TCP server — following patterns used in Redis, RocksDB, and PostgreSQL.

Quickstart

Get RadishDB running in minutes using Docker or building from source

Command Reference

Explore all supported commands: SET, GET, DEL, TTL, and more

Architecture

Understand the protocol-agnostic engine design

C API

Embed RadishDB directly in your C programs using the internal API

Key features

Write-ahead logging

Every mutation is written to an append-only file (AOF) before being applied, guaranteeing crash safety

Crash recovery

On startup, RadishDB replays the AOF to restore state deterministically after any crash

TTL & expiration

Per-key time-to-live with both passive expiration on read and active background sweeping

Log compaction

AOF rewrite serializes current state into a compact log, removing obsolete history

Binary snapshots

Save and restore full database state with the .rdbx snapshot format

TCP server

Serve clients over TCP on port 6379 — connect with netcat, telnet, or any socket client

Interactive REPL

Built-in REPL mode for local development and exploration

Docker support

Multi-stage Dockerfile and Docker Compose for containerized deployment

Architecture overview

RadishDB separates storage from protocol handling:
engine.c      → command parsing and semantics (no I/O)
hashtable.c   → core storage engine
aof.c         → write-ahead log (durability)
expires.c     → TTL and expiration sweeper
persistence.c → binary snapshot (.rdbx)
repl.c        → interactive REPL frontend
server.c      → TCP server frontend
main.c        → startup and lifecycle
This design means the same engine powers both the REPL and the TCP server, with no duplication of command logic.

Project status

RadishDB is a stable learning release — architecturally serious, fully functional, and containerized for real deployment.
RadishDB is single-threaded by design. It does not support replication, clustering, or SQL queries. See Architecture for intentional design decisions.

Build docs developers (and LLMs) love