Plone.app.caching for the main page only

I would like to enable caching of the content of the item / folder only for the main page of the site (complex, heavy loading operations).

What would be a good approach to the "cache only with a specific path" problem with plone.app.caching?

+4
source share
1 answer

One approach is to define a new set of caching rules and associate it with your home view. You can then assign the strong or moderate caching operation to this rule set, leaving the other rule sets set to Weak or None.

ZCML to define a new rule set and map it to the homepage view will look like this if the homepage view is ".homepage.HomepageView":

<configure xmlns="http://namespaces.zope.org/zope" xmlns:browser="http://namespaces.zope.org/browser" xmlns:cache="http://namespaces.zope.org/cache"/> <include package="z3c.caching" file="meta.zcml" /> <cache:rulesetType name="plone.homepage" title="Homepage" description="Site homepage view" /> <cache:ruleset for=".browser.HomepageView" ruleset="plone.homepage" /> </configure> 

(See the z3c.caching documentation for more information on the cache directives used here.)

If your home page is a template in the CMF skin block and not in a view, you can associate it with a set of rules in the "Caching" tab of the plone.app.caching control panel instead of using a set of caches: ruleset directive.

A completely different approach would be to process the main page specifically in reverse proxy configuration.

+4
source

All Articles