Although Memcached is well established in the market as a caching mechanism, and well supported by Django, Redis is an alternate system that provides all the functionality of Memcached and more. Here, we'll revisit the process from the Using Memcached to cache Django views recipe and learn how to do the same using Redis instead.
Using Redis to cache Django views
Getting ready
There are several things we need to do in order to prepare caching for our Django project:
- Let's install the Redis service. For example, the simplest way to do that on macOS is to use Homebrew:
$ brew install redis
- Then, you can start, stop, or restart the Redis service with these commands:
$ brew services start redis
$ brew services stop...