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

Page cache with dynamic plugins #6562

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

Comments

Projects
None yet
2 participants
@arianitu

arianitu commented Nov 20, 2018

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

This comment has been minimized.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment