Memcached Setup for Django

A snippet showing how to configure Memcached for caching.


# Install backend
pip install python-memcached
      

# settings.py

CACHES = {
    "default": {
        "BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
        "LOCATION": "127.0.0.1:11211",
    }
}
      
Explanation:
  • Django uses Memcached for cache operations (fast in-memory).
Previous snippet
Low-Level Cache API Example
Next snippet
Redis Cache Setup
Never miss a story on Django.wiki

Subscribe for fresh tutorials, snippets, and updates.

By subscribing you agree to our Privacy Policy.