Caching in Divio applications

Caching in Divio Cloud applications will typically make use of Django’s own caching framework.

Caching options

Database caching

Our default cache backend is Django’s database caching; all Divio Cloud projects are set up with this configured and ready to use.

This is a fast, scalable option, and is suited to most needs.

Database caching is shared by all instances of an application server.

Local per-instance caching


Per-instance caching options are not suitable for django CMS sites, which require synchronisation of data across instances for correct operation.

Depending on the needs of other applications, you may or may not find that these options are suitable.

Per-instance caching options cache data for a particular instance of the cloud application server. This means that if your project is running on multiple server instances, they will not share the caches.

For the same reason if you SSH into a Cloud server and do:

from django.core.cache import cache


in a Python shell, you will only clear the cache in the container you have just started up.

Options are:

Third-party caching backends

Other backends, such as Redis (a popular open-source database) can be used as caching backends for Django.

If it suits your needs, you can procure a Redis or other caching instance from a provider and use it with your Divio Cloud project.

Caching in django CMS

The Aldryn django CMS addon applies caching rules by default, via the CMS_CACHE_DURATIONS setting.

Control over caching settings is exposed in the Divio Cloud Control Panel in the configuration options for Aldryn django CMS.

Defaults are to cache content for 60 seconds and menus for one hour.

It is often convenient to disable this while developing or working intensively on content. Adding:

import os
env = os.getenv
STAGE = env('STAGE', 'local').lower()
if STAGE in {'local', 'test'}:
    CMS_PAGE_CACHE = False
        'menus': 0,
        'content': 0,
        'permissions': 0,

to the project’s will disable all caching in the CMS in the local and Test environments.