Thanks to visit codestin.com
Credit goes to github.com

Skip to content

spaghetti-lover/RediGo

Repository files navigation

RediGo

                            ██████  ███████ ██████  ██  ██████   ██████
                            ██   ██ ██      ██   ██ ██ ██       ██    ██
                            ██████  █████   ██   ██ ██ ██   ███ ██    ██
                            ██   ██ ██      ██   ██ ██ ██    ██ ██    ██
                            ██   ██ ███████ ██████  ██  ██████   ██████

⚡ A Redis-like multithread in-memory datastore built in Go from scratch ⚡

License: MIT Go Version Stars

Table of contents

Description

This project is a from-scratch implementation of a Redis-like in-memory data store written in Go, focusing on I/O Model, RESP protocol, core commands, data structures, caching, and concurrency model.

  • CLI:

Screenshot of demo

Installation

Requirements

  • Go 1.24+
  • (Optional) Docker or Podman for containerized deployment

Clone the project

git clone https://github.com/spaghetti-lover/RediGo.git

Usage

Run the project

  • Run CLI
go mod tidy
go run cmd/main.go
  • Run with Docker-compose
make dev
  • Run with Docker (single container), useful for deployment
make deploy

Connect with redis-cli (optional)

redis-cli -p 6379

Benchmark

./redis/src/redis-benchmark -p 3000 -t set -n 1000000 -r 1000000

./redis/src/redis-benchmark -n 1000000 -t get -c 500 -h localhost -p 3000 -r 1000000 --threads 3

Features

  • ⚡ Server models: Simple TCP server, Thread Pool, One thread per connection, I/O multiplexing (epoll, kqueue), Shared-nothing architecture

  • 🔗 Protocol: Redis Serialization Protocol (RESP)

  • 🛠️ Core Commands:

    • Hash Map: GET, SET, TTL, DEL, auto key expiration
    • Simple Set: SADD, SREM, SMEMBERS, SISMEMBER
    • Sorted Set: ZADD, ZSCORE, ZRANK (with both skip list and B+ Tree)
    • Count-min Sketch: CMS.INCRBY, CMS.QUERY, CMS.INITBYDIM
    • Bloom Filter: BF.ADD, BF.EXISTS, BF.RESERVE
  • 🔑 Passive, Active expired key deletion

  • 🧹 Caching: Random, approximated LRU, approximated LFU

  • 🧵 Graceful shutdown and connection handling

TODO

  • Implement server model io_uring (Linux)
  • Geospatial
  • List
  • Bitmap
  • HyperLogLog
  • Queue
  • Pipeline
  • Authentication
  • Persistence: RDB, AOF

License

MIT

About

Note: On Render, the frontend may start before the backend finishes initializing, so expect a short delay on first load.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published