Key-value stores

You can use applications such as Memcached or Redis for external caching. These applications offer persistence and shared storage and are useful for small-scale deployments and/or development.

 Memcached

Memcached is an high-performance and distributed memory object caching system providing in-memory key-value store for small chunks of arbitrary data.

Requirements:

  • Memcached service running and accessible.

  • Python module python-memcached installed.

Enabled by:

SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
CACHES = {
    'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache'
    'LOCATION': 'my_memcached_host:11211',
}

 Redis

Redis is an open source, BSD licensed, advanced key-value store. It is often referred to as a data structure server.

Requirements:

  • Redis service running and accessible.

  • Python modules redis and django-redis installed.

Enabled by:

SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
CACHES = {
    "default": {
        "BACKEND": "redis_cache.cache.RedisCache",
        "LOCATION": "127.0.0.1:6379:1",
        "OPTIONS": {
            "CLIENT_CLASS": "redis_cache.client.DefaultClient",
        }
    }
}
Log a bug against this page


loading table of contents...