Intro and Quick Start


django-redis-cache is a cache backend for the Django webframework. It uses the redis server, which is a in-memory key-value data structure server. Similar to the great Memcached in performance, it has several features that makes it more appealing.

  • Multiple data structures types, e.g. string, list, set, sorted sets, and hashes.
  • Atomic pipelines: guaranteed that multiple commands will run sequentially and uninterrupted.
  • Pub/Sub: subscribe to a channel and listen for messages from other processes.
  • Can back data to disk, which can keep a cache warm even if the process is killed.
  • Lua scripting
  • Clustering (as of 3.0)
  • Many more.

Many of these features are irrelevant to caching, but can be used by other areas of a web stack and therefore offer a compelling case to simplify your infrastructure.

Quick Start


1. Install redis. You can use to install a local copy of redis. Start the server by running ./src/redis-server

  1. Run pip install django-redis-cache.
  2. Modify your Django settings to use redis_cache.
    'default': {
        'BACKEND': 'redis_cache.RedisCache',
        'LOCATION': 'localhost:6379',

Warning: By default, django-redis-cache set keys in the database 1 of Redis. By default, a session with redis-cli start on database 0. Switch to database 1 with SELECT 1.