Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A dynamic plugin with disabled caching turns it off for the whole page #6562

Open
arianitu opened this issue Nov 20, 2018 · 1 comment
Open

Comments

@arianitu
Copy link

Summary

I'm trying to understand how django-cms handles caching because it's a little unintuitive. I want the entire page to be cached, but if I have a plugin that is dynamic based on the output, I can't actually get caching?

Why can't django-cms just load the page normally and then cache based on all the dynamic output during that load?

Instead, I have to the disable plugin cache and then the entire page never caches.

Expected behaviour

Page is loaded dynamically the first time, the second time it's cached based on the dynamic output of the last load.

Actual behaviour

Pages won't cache with a plugin that generates dynamic values. So you either have to pick the page generating the wrong values, or have no cache?

Environment

  • Python version: 3.6.5
  • django CMS version: 3.4.5
@benzkji
Copy link
Contributor

benzkji commented Nov 21, 2018

What do you mean with "a plugin that is dynamic based on the output"?

Anyway, if you specify cache=False on a cms plugin, the page displaying that plugin will never be cached, and, most important, no cache headers that say "cache this", are sent. This is intendend, and needed like this. otherwise, you would need a per user/session cache, per IP, or whatever constraints you have...endless! the get_cache_expiration plug allows some more fine grained control if needed..

As far as I know, not dynamic plugin output might get cached anyway, but I'm not sure here.

docs: http://docs.django-cms.org/en/latest/reference/plugins.html#cms.plugin_base.CMSPluginBase.cache
get_cache_expiration: http://docs.django-cms.org/en/latest/reference/plugins.html#cms.plugin_base.CMSPluginBase.get_cache_expiration

@Aiky30 Aiky30 added this to the DCA Needs clarification milestone Dec 8, 2020
@victor-yunenko victor-yunenko changed the title Page cache with dynamic plugins A dynamic plugin with disabled caching turns it off for the whole page Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants