crabdis
It's like Redis but a bit rusty...
What?
This is a simple in-memory key-value store written in Rust. It's somewhat compatible with Redis via the RESP protocol, but it's not a drop-in replacement. A lot of commands are missing and stuff might not work as expected.
[!NOTE] While it's technically possible to run
crabdisin production, it's not recommended, use at your own risk!
Why?
I like tinkering with stuff I use and Redis is a great tool. It was started when the License fiasco happened and I wanted to write my own Redis-compatible server in Rust. This project works with notable clients like ioredis and Bun.
[!IMPORTANT] Bun support is only available since version
0.1.25ofcrabdisdue to incorrect RESP3 support in earlier versions. As always, use the latest version ofcrabdisandbunto get the best experience.
Installation
You can find binaries on the releases page. Or you can build it yourself with cargo build --release.
If you want to install it with cargo, you can do so with cargo install crabdis.
There is also a Docker image available on Docker Hub.
Usage
By default, crabdis will listen on all addresses on port 6379. This is the same as running crabdis --address :: --port 6379. This has been chosen because Railway's internal networking used to be IPv6 only.
TODO / Missing Features
- Basic RESP protocol implementation
- GET, SET, DEL, EXISTS, KEYS, FLUSHDB
- COMMAND / COMMAND DOCS (so ioredis works)
- SET arguments (EX, PX, NX, XX) + SETEX, PSETEX
- Hash Command family (HGETALL, HSET)
- Pub/Sub support (PUBLISH, SUBSCRIBE, UNSUBSCRIBE)
- Additional commands (INCR, MGET, MSET, TYPE, SCAN, SELECT, RENAMENX, INFO, HELLO)
- Persistence
- More Hash commands (HGET, HDEL, etc.)
- List commands
- Set commands
- Sorted Set commands
Benchmarks
Below are micro-benchmarks for core Value operations and RESP serialization/deserialization (run with cargo bench).
It's pretty fast actually.
License
This project is licensed under the MIT License.