This is a simplified version of Redis implemented using Flask.
- Data Storage: An in-memory storage for key-value pairs.
- Supported Commands:
- SET key value: Stores the key-value pair in the database.
- GET key: Retrieves the value associated with the key.
- DEL key: Deletes the key-value pair from the database.
- EXPIRE key seconds: Sets a timeout on the specified key. After the timeout has expired, the key should be deleted.
- TTL key: Returns the remaining time to live of a key that has an expiration set, in seconds.
- Persistence:
- A simple mechanism to persist the data to a json file
- Data reloads on server start.
- Networking: A simple TCP server that handles incoming requests and send responses.
- Concurrency: Multiple clients can connection simultaneously.
- Clone the repository:
git clone https://github.com/noahnsimbe/mini-redis.git
cd mini-redis
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate
- Install the dependencies:
pip install --upgrade pip
pip install -r requirements.txt
- Create a
.env
file using contents of the env.example:
cp env.example .env
python app.py
The server will be accessible at http://localhost:5000
chmod +x run.sh
./run.sh
The server will be accessible at http://localhost:5000
API documentation is available at http://localhost:5000/apidocs
.