Django cache - memcached cache



Memcached is a daemon server which will do the process of caching. The Memcached will be running as a daemon with a memory RAM allocated for it. There are several Memory cache’s in the market. Some among the popular ones are listed here,

          a) pylibmc

          b) pymemcache 

          d) memcachedcache

The below example shows Django cache system based on memcachedcached

1) Download the Memcached software and extract the software to a desktop location.

2) To view the various options of Memcached below command can be used. Ensure to shift to Memcached directory before executing the command to view the options.

         cd C:\Users\ANAND\Downloads\memcached-win32-1.4.4-14
.\memcached.exe -h

3) Set the Memcached active using its commands, one sample command is given below.

.\memcached.exe -m 512 -vvv

4) Install the Memcached client in python

pip install python-memcached

5) In Django project set cache values in settings.py file,

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

Output:  A snap from the memcached cmd which is ready to catch any cookies from the site.



Comments