A minimal Redis-like key/value store written in
.
It listens on the default Redis port (6379) and supports a tiny subset of the Redis protocol.
-
HEALTH
Simple health check.
Example:HEALTH→OK -
SET key value
Stores a string value under a string key.
Example:SET mykey hello→OK -
GET key
Retrieves the value for a given key or returns a null bulk string if it does not exist.
Example:GET mykey→hello
Crabis uses a TcpListener from tokio to accept incoming TCP connections on port 6379.
Each connection is handled in its own asynchronous task using tokio::spawn, so multiple clients can be served concurrently without blocking the main thread.
For storage, it relies on a DashMap, a concurrent hash map.
This means multiple tasks can read and write keys at the same time safely and efficiently, without manually managing locks.
redis-cliinstalled
From the project root, you can build and run the server with:
-
Using Cargo
cargo buildcargo run
-
Using Makefile
make start
Crabis now listens on 127.0.0.1:6379.
In another terminal, you can connect with:
redis-cli -h 127.0.0.1 -p 6379You can also enable the Append Only File (AOF) mode to persist SET commands to disk:
cargo run -- AOFIn AOF mode, every SET key value is appended to a log file so the in-memory store can be reconstructed on restart.
Q: Why “Crabis”? What is this stupid name?
A: The project is inspired by Redis (it contains “Red”), and since it’s written in Rust, which is associated with the color orange, I first thought about calling it “Orangeis", but that sounded a bit odd. Since Rust’s mascot is an orange crab, I came up with “Crabis.”