Build Your Own Redis with Go
This project is a practical implementation of the concepts presented in the book "Build Your Own Redis with C/C++". The goal of this project is to provide a hands-on learning experience by building a simplified version of the Redis-like server using Go.
Table of Contents
Introduction
This project is a result of studying the book "Build Your Own Redis with C/C++". It aims to help developers gain a deeper understanding
of network programming and data structures.
Getting Started
To get started with the project, follow these steps:
- Clone the repository:
git clone https://github.com/miladbarzideh/goldis.git
- Navigate to the project directory:
cd goldis
- Run the application:
cd cmd/goldis/ && go build && ./goldis
- Use netcat to communicate with server:
nc localhost 6380
- Apply any basic command like:
set key value
Server Commands
- SET:
SET key value
- GET:
GET key
- DEL:
DEL key
- KEYS:
KEYS
- PEXPIRE:
PEXPIRE key 10000
(ms)
- PTTL:
PTTL key
- ZADD:
ZADD key 20 name
- ZSCORE:
ZSCORE key name
- ZREM:
ZREM key name
- ZQUERY:
ZQUERY key 18 name 0 10
- ZSHOW:
ZSHOW key
Concepts Explored
Throughout the development of this project, the following key concepts were explored and implemented:
Concepts Explored |
Implemented Features |
Further Steps |
Network programming |
Nonblocking IO, Event loop |
Protocol parsing |
Hashtable |
Hashtable, Chaining, Resizing, Intrusive DS |
|
AVL Tree |
Intrusive DS |
|
Sorted Set |
Hashtable + AVL Tree |
Skip List |
Timers |
Kick out idle connections |
|
Heap and TTL |
TTL with Min Heap |
|
Thread Pool - Asynchronous Tasks |
The producer-consumer problem, Synchronization primitives (Mutex) |
Try other ways |
Contributing
Contributions to this project are welcome! If you find any issues or want to add new features, feel free to create a pull request.