开发者

plone.app.caching for front page only

I'd like to enable content item/folder cache-in-proxy for the site front page only (complex, heavy loading operations).

What would be good approach to "cache in only certain path" problem wi开发者_C百科th plone.app.caching?


One approach is to define a new caching ruleset, and associate it with your homepage view. You can then assign the Strong or Moderate caching operation to this ruleset while leaving the other rulesets set to Weak or No caching.

The ZCML for defining the new ruleset and associating it with the homepage view would be as follows, assuming 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 on the cache directives used here.)

If your homepage is a template in a CMF skin layer rather than a view, you can associate it with a ruleset on the "Caching operations" tab of the plone.app.caching control panel, instead of using the cache:ruleset directive.

A completely different approach would be to handle the homepage specially in your reverse proxy configuration.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜