Adding Memcached to your project

Let's configure the cache for our project. Edit the settings.py file of the educa project and add the following code to it:

CACHES = {    'default': {        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',        'LOCATION': '127.0.0.1:11211',    }}

We are using the MemcachedCache backend. We specify its location using the address:port notation. If you have multiple Memcached instances, you can use a list for LOCATION.

Get Django 2 by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.