Using Redis with Horizon

Redis is an open source, BSD licensed, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.

To use Redis with Horizon first install and configure Redis on the system running the Horizon WSGI processes. Packages are available in the project server:database on the openSUSE Build Service.

# zypper install -y redis
# mv /etc/redis/default.conf.example /etc/redis/default.conf
# service redis start

Then install the package python-django-redis and the needed dependencies python-redis and python-py. Packages are soon available in the project devel:languages:python.

As last step replace the existing configuration parameters SESSION_ENGINE and CACHES in the configuration file of Horizon (local_settings.py) with the following lines and restart the WSGI processes afterwards.

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",
        }
    }
}

Now Horizon uses Redis as cache. Verification is possible with the tool redis-cli.