This project is a lightweight in-memory key-value store developed in Go, designed to replicate essential features of Redis. It supports various data structures and provides a scalable architecture for concurrent client interactions.
- SET key value
- GET key
- HSET key field value
- HGET key field
- HGETALL key
- EXPIRE key seconds
- DEL key
- EXISTS key
- LPUSH key value
- RPUSH key value
-
Data Structures: Implemented support for:
- Strings
- Hashes
- Lists
- Sets
- Sorted Sets
-
Concurrent Client Support: Engineered a client-server model that allows multiple clients to connect and interact seamlessly.
-
Redis Command Compatibility: Supports standard Redis commands, enabling users to perform data manipulation with existing Redis client software.
- Go 1.23 or later
- Clone the repository:
git clone https://github.com/ghulamazad/redis-clone.git
cd redis-clone
- Build the project:
make build
- Run the server:
./dist/redis-clone
If you prefer to run the project in a Docker container, follow these instructions:
- Clone the repository (if you haven't already):
git clone https://github.com/ghulamazad/redis-clone.git
cd redis-clone
- Build the Docker image:
docker build -t redis-clone .
- Run the Docker container:
docker run -p 6379:6379 redis-clone
This command maps port 6379 of your host machine to port 6379 of the container. Adjust the port number if your application uses a different one.
To stop the running container, find its container ID with:
docker ps
Then use the following command to stop it:
docker stop <container_id>
Replace <container_id> with the actual ID of the running container.
If you want to remove the stopped container and the image, use:
docker rm <container_id>
docker rmi redis-clone
Connect to the server using a Redis client and start executing commands. Here are a few examples:
- Set a key:
SET key "value"
- Get a key:
GET key
Contributions are welcome! Please submit a pull request or open an issue for any feature requests or bug reports.
This project is licensed under the MIT License. See the LICENSE file for details.
Inspired by Redis, this project aims to deepen understanding of key-value store architecture and concurrency in Go.
Feel free to explore and contribute!