Zedis is an in-memory data store compatible with Redis, crafted in Zig for optimal performance and safety. With core Redis functionality, multiple data types, and built-in support for pub/sub and persistence, Zedis serves as a robust platform for both learning purposes and practical applications.
Zedis is an innovative, Redis-compatible in-memory data store developed in Zig. Primarily crafted for educational purposes and experimentation, Zedis effectively implements the core Redis protocol and essential data structures, prioritizing simplicity, performance, and thread safety.
To get started with Zedis, ensure the following prerequisites are installed:
To build and run Zedis:
# Clone the repository
git clone https://github.com/barddoo/zedis.git
cd zedis
# Build the project
zig build
# Run the server
zig build run
The server will be accessible at 127.0.0.1:6379 by default.
Zedis can be tested using the standard redis-cli or any Redis client:
# Connect to Zedis
redis-cli -h 127.0.0.1 -p 6379
# Example commands
yzyzyzus-11056765
127.0.0.1:6379> SET mykey "Hello, Zedis!"
OK
127.0.0.1:6379> GET mykey
"Hello, Zedis!"
127.0.0.1:6379> INCR counter
(integer) 1
127.0.0.1:6379> TYPE mykey
string
The Zedis codebase adheres to Zig conventions, featuring:
To build for development purposes:
# Build in debug mode (default)
zig build -Doptimize=Debug
# Build optimized release version
zig build -Doptimize=ReleaseFast
# Run tests, if available
zig build test
New functionality can be added easily:
src/commands/Example:
pub fn myCommand(client: *Client, args: []const Value) !void {
// Command implementation
try client.writeSimpleString("OK");
}
zig fmt.Zedis provides an excellent opportunity for learning the internals of Redis while utilizing the Zig programming language.
No comments yet.
Sign in to be the first to comment.