- ๐ About the Project
- ๐ Overview
- ๐ Built With
- ๐ฅ Tech Stack
- ๐ Key Features
- ๐ป Getting Started
- ๐ Prerequisites
- โ๏ธ Setup
โถ๏ธ Run Application- ๐น๏ธ Usage
- ๐ฅ Author
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.
- 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.
- Python
- Django
- Redis
- JSON
- Django
- Redis
- 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.
To use this service, you will need:
- Python 3.x
- Django
- Redis server installed
- Required Python libraries:
django-redis,json.
-
Clone the repository:
git clone https://github.com/your-repo/redis-cache-management.git
-
Navigate to the project directory:
cd redis-cache-management -
Install the required dependencies:
pip install -r requirements.txt
-
Configure Redis in Django:
In your Django project's
settings.py, add the following configuration:CACHES = { "default": { "BACKEND": "django_redis.cache.RedisCache", "LOCATION": "redis://127.0.0.1:6379/1", "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", } } }
-
Start the Redis server:
sudo service redis-server start
- Run the Django development server:
python manage.py runserver
- Set Data: Use the
setredisdatamethod to store data in Redis. - Get Data: Use the
getredisdatamethod to retrieve cached data. - Delete Data: Use the
deleteredisdatamethod to delete cache entries as needed.
- ๐ฅ Author
- Vedant Vartak
- Email โ๏ธ: vedantvartakworkk@gmail.com
- Country ๐: India ๐ฎ๐ณ
- Vedant Vartak
Example Usage:
To set data in the cache, you can send a POST request to the setredisdata endpoint with the following payload:
{
"key": "unique_key",
"value": {
"data": "your_data"
}
}