How to use Redis with Django For Caching
100 times faster web applications with Redis
First thing first.
Redis is not actually a database at least not like any SQL or NoSQL databases out there. One could argue it's a NoSQL database since it stores data in key-value pairs. And it'd not be a wrong statement.
It's a database but it's not a database. Okay okay, hold on it's a database but used just for caching.
The important thing here is you need to know that, it is a RAM-based data storing system mostly used on the top of any database of your choice for caching your application in production to speed up your application by a significant amount of time.
You can use it with pretty much any website or application you build using any of the available tech stacks.
Here we are gonna have a look at how we can use Redis with Django web applications for caching
Let's get started
To download Redis on Linux according to your package manager
Debian and it's derivatives
sudo apt-get install redis
Arch and it's derivatives
sudo pacman -S redis
For more options to download including windows and mac Clicke here
To verify your installation simply run
redis-cli --version
Get the django-redis package which is used to connect our django app with he redis database It is a python package Django-Redis
Install it with the command
pip install django-redis
Often used alternative is Memcache