plone.app.caching 仅用于首页
我想仅为网站首页启用内容项/文件夹代理缓存(复杂、繁重的加载操作)。
plone.app.caching 的“仅在特定路径中缓存”问题的好方法是什么?
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 with plone.app.caching?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种方法是定义一个新的缓存规则集,并将其与您的主页视图相关联。然后,您可以将强或中等缓存操作分配给该规则集,同时将其他规则集设置为弱或无缓存。
用于定义新规则集并将其与主页视图关联的 ZCML 如下,假设主页视图为“.homepage.HomepageView”:(
请参阅 z3c.caching 文档,了解有关此处使用的缓存指令的更多信息。)
如果您的主页是 CMF 皮肤层中的模板而不是视图,则可以将其与plone.app.caching 控制面板的“缓存操作”选项卡上的规则集,而不是使用 cache:ruleset 指令。
一种完全不同的方法是在反向代理配置中专门处理主页。
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":
(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.