This project is a simplified clone of Redis, supporting basic commands and using the Redis Serialization Protocol (RESP) for communication and Data persistence using Append Only File (AOF).
**This project is for educational purposes and not meant to be on production.**
This Redis clone supports the following commands:
SET
GET
HSET
HGET
HGETALL
DEL
EXISTS
To install and run this project:
-
Clone the repository:
git clone https://github.com/MikhailWahib/redis-clone.git cd redis-clone
-
Build the project:
go build ./...
-
Run the server:
./redis-clone
- Start your Redis clone server as shown above.
- Use the Redis CLI on the default port to interact with your server:
redis-cli -h 127.0.0.1 -p 6379
To run the tests:
go test -v
- SET: Set a key to a string value.
SET key value
- GET: Get the value of a key.
GET key
- HSET: Set a field in a hash to a value.
HSET hash field value
- HGET: Get the value of a field in a hash.
HGET hash field
- HGETALL: Get all fields and values in a hash.
HGETALL hash
- DEL: Delete values with keys
DEL key [key...]
- EXISTS: Check if keys exist
EXISTS key [key...]
main.go
: Entry point of the application.resp.go
: Contains RESP parsing logic.handler.go
: Contains the implementations of supported commands handlers.aof.go
: Contains the logic of AOF.