Redis

Redis is used for caching to improve the performance and scalability of the application by reducing the load on the database.

Setup and Integration

  1. Install Redis: This works only on macOS

sudo apt-get install redis-server
  1. Start Redis:

redis-server
  1. Integrate with Django: Install django-redis

pip install django-redis

Configure Django settings

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

Last updated