Django allows us to speed up the request-response cycle by caching the most expensive parts, such as database queries or template rendering. The fastest and most reliable caching natively supported by Django is the memory-based cache server Memcached. In this recipe, you will learn how to use Memcached to cache a view for the viral_videos app. We'll explore this further in the Using database query expressions recipe in Chapter 10, Bells and Whistles.
Using Memcached 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 memcached service. For example, the simplest way to do that on macOS is to use Homebrew:
$ brew install...