Skip to content

A high-performance, Redis-compatible distributed cache system built in Go. zephyr provides horizontal scalability, high availability, and advanced caching features for modern applications.

Notifications You must be signed in to change notification settings

Nadeerpk/zephyr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zephyr

A distributed in-memory cache system built in Go.

Go Version License

Project Overview

The project implements:

  • Redis-compatible protocol for seamless client integration
  • Distributed caching with consistent hashing
  • Master-slave replication for high availability
  • Memory-efficient cache engine with TTL support

Core Features

Cache Engine

  • Thread-safe concurrent operations
  • TTL-based key expiration
  • Basic Redis commands (GET, SET, DEL, etc.)
  • Configurable cache size and eviction policies

Distributed Architecture

  • Consistent hashing for data distribution
  • Master-slave replication
  • Automatic node discovery
  • Cluster management and health checks

Tech Stack

  • Language: Go 1.21+
  • Testing: Built-in Go testing framework with testify
  • Protocol: Redis RESP protocol
  • Architecture: Distributed systems, microservices

Getting Started

# Clone the repository
git clone https://github.com/Nadeerpk/zephyr.git
cd zephyr

# Run tests
go test ./...

# Build the binary
go build -o zephyr cmd/main.go

# Start a single node
./zephyr --port 6379

# Start a cluster master node
./zephyr --port 7009 --role master --seeds 127.0.0.1:7002 --slaves 127.0.0.1:7003
# Start a cluster slave node
./zephyr --port 7003 --role slave --master 127.0.0.1:7009 --slaves 127.0.0.1:7003
# Start a cluster seed node
./zephyr --port 7002 --role master

Usage Example

import "github.com/go-redis/redis/v8"

client := redis.NewClient(&redis.Options{
    Addr: "localhost:6379",
})

// Set a key with TTL
client.Set(ctx, "mykey", "myvalue", time.Minute)

// Get a key
val, err := client.Get(ctx, "mykey").Result()

Project Structure

.
├── cmd/
│   └── main.go            # Application entry point
├── internal/
│   ├── cache/            # Core cache implementation
│   ├── cluster/          # Clustering logic
│   ├── consistent/       # Consistent hashing
│   ├── protocol/         # RESP protocol parser
│   ├── replication/      # Master-slave replication
│   └── server/           # TCP server implementation
└── tests/                # Integration tests

Future Improvements

  • Add persistence layer
  • Implement more Redis commands
  • Add metrics and monitoring
  • Improve cluster management
  • Add authentication and TLS support

License

This project is licensed under the MIT License - see the LICENSE file for details.


About

A high-performance, Redis-compatible distributed cache system built in Go. zephyr provides horizontal scalability, high availability, and advanced caching features for modern applications.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages