Skip to content

Latest commit

 

History

History
102 lines (78 loc) · 1.89 KB

README.md

File metadata and controls

102 lines (78 loc) · 1.89 KB

Redis Clone

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.**

Table of Contents

Overview

This Redis clone supports the following commands:

  • SET
  • GET
  • HSET
  • HGET
  • HGETALL
  • DEL
  • EXISTS

Installation

To install and run this project:

  1. Clone the repository:

    git clone https://github.com/MikhailWahib/redis-clone.git
    cd redis-clone
  2. Build the project:

    go build ./...
  3. Run the server:

    ./redis-clone

Usage

  1. Start your Redis clone server as shown above.
  2. Use the Redis CLI on the default port to interact with your server:
    redis-cli -h 127.0.0.1 -p 6379

Testing

To run the tests:

go test -v

Supported Commands

  • 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...]

Project Structure

  • 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.