Caching

Set-up

To setup caching configure a caching backend in django.

Details for caching can be found here: https://docs.djangoproject.com/en/dev/topics/cache/

In your middleware settings be sure to add django.middleware.cache.UpdateCacheMiddleware at the first and django.middleware.cache.FetchFromCacheMiddleware at the last position:

  1. MIDDLEWARE_CLASSES=[
  2. 'django.middleware.cache.UpdateCacheMiddleware',
  3. ...
  4. 'cms.middleware.language.LanguageCookieMiddleware',
  5. 'cms.middleware.user.CurrentUserMiddleware',
  6. 'cms.middleware.page.CurrentPageMiddleware',
  7. 'cms.middleware.toolbar.ToolbarMiddleware',
  8. 'django.middleware.cache.FetchFromCacheMiddleware',
  9. ],

Plugins

New in version 3.0.

Normally all plugins will be cached. If you have a plugin that is dynamic based on the current user or other dynamic properties of the request set the cache=False attribute on the plugin class:

  1. class MyPlugin(CMSPluginBase):
  2. name = _("MyPlugin")
  3. cache = False

Warning

If you disable a plugin cache be sure to restart the server and clear the cache afterwards.

Content Cache Duration

Default: 60

This can be changed in CMS_CACHE_DURATIONS

Settings

Caching is set default to true. Have a look at the following settings to enable/disable various caching behaviours: