Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vedantwork/redis-cache-management

Redis Cache Management is a powerful and efficient caching solution designed to optimize data retrieval and application performance by leveraging the Redis in-memory data structure store. This component provides a streamlined approach to managing cached data, reducing latency, and minimizing load on backend databases or services.
https://github.com/vedantwork/redis-cache-management

django python redis redis-cache

Last synced: 27 days ago
JSON representation

Redis Cache Management is a powerful and efficient caching solution designed to optimize data retrieval and application performance by leveraging the Redis in-memory data structure store. This component provides a streamlined approach to managing cached data, reducing latency, and minimizing load on backend databases or services.

Awesome Lists containing this project

README

        


REDIS CACHE MANAGEMENT


Optimized caching solution for Django applications using Redis


## 📗 Table of Contents

- 📖 About the Project
- 👀 Overview
- 🛠 Built With
- đŸ”Ĩ Tech Stack
- 🔑 Key Features
- đŸ’ģ Getting Started
- 📜 Prerequisites
- ⚙ī¸ Setup
- â–ļī¸ Run Application
- 🕹ī¸ Usage
- đŸ‘Ĩ Author

## 📖 About the Project

Redis Cache Management is a backend microservice integrated into a Django application, designed to optimize data retrieval and application performance by leveraging Redis as an in-memory data store. This service streamlines cache management, reduces latency, and minimizes load on backend databases.

## 👀 Overview

- The service provides methods to store (`setredisdata`), retrieve (`getredisdata`), and delete (`deleteredisdata`) cached data in Redis.
- It handles caching efficiently, storing responses for up to 45 days to reduce the need for repeated data fetching from the backend.

## 🛠 Built With

- Python
- Django
- Redis
- JSON

### đŸ”Ĩ Tech Stack

- Django
- Redis

### 🔑 Key Features

- **Efficient Caching**: Caches data for up to 45 days to reduce backend load.
- **Data Retrieval**: Retrieves data from the cache, minimizing response time.
- **Cache Management**: Provides methods to set, get, and delete cache entries.

## đŸ’ģ Getting Started

### 📜 Prerequisites

To use this service, you will need:

- Python 3.x
- Django
- Redis server installed
- Required Python libraries: `django-redis`, `json`.

### ⚙ī¸ Setup

1. **Clone the repository**:
```bash
git clone https://github.com/your-repo/redis-cache-management.git
```

2. **Navigate to the project directory**:
```bash
cd redis-cache-management
```

3. **Install the required dependencies**:
```bash
pip install -r requirements.txt
```

4. **Configure Redis in Django**:

In your Django project's `settings.py`, add the following configuration:

```python
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/1",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
}
}
}
```

5. **Start the Redis server**:
```bash
sudo service redis-server start
```

### â–ļī¸ Run Application

1. **Run the Django development server**:
```bash
python manage.py runserver
```

### 🕹ī¸ Usage

1. **Set Data**: Use the `setredisdata` method to store data in Redis.
2. **Get Data**: Use the `getredisdata` method to retrieve cached data.
3. **Delete Data**: Use the `deleteredisdata` method to delete cache entries as needed.

- [đŸ‘Ĩ Author](#author)
- Vedant Vartak
- Email ✉ī¸: [email protected]
- Country 🌍: India 🇮đŸ‡ŗ

**Example Usage**:

To set data in the cache, you can send a POST request to the `setredisdata` endpoint with the following payload:

```json
{
"key": "unique_key",
"value": {
"data": "your_data"
}
}