在magento(企业)中禁用全页缓存(FPC)的缓存请求的最佳实践是什么
我希望删除以下设置:
<cms>enterprise_pagecache/processor_default</cms>
...从 core / Enterprise / PageCache / config.xml 文件的 config.xml 中,以便主页不会被缓存,(因为我们有一个复杂的自定义商店开关) 。
由于该值未存储在 core_config_data 中,我不确定覆盖开箱即用值的最佳方法。核心文件中行上方的注释确实暗示编辑此文件实际上并不是不好的做法,但是,我可以将其向社区打开以了解他们的想法吗?
PS = 这是一个带有自定义商店切换器的多网站设置。
I wish to remove the following setting:
<cms>enterprise_pagecache/processor_default</cms>
... from the config.xml of the core / Enterprise / PageCache / config.xml file so that the home page will not be cached, (because we have a complicated custom store switch in place).
Since this value is not stored in core_config_data I am unsure of the best way to override the out of the box value. The comments above the line in the core file do hint that it is not actually bad practice to edit this file, however, can I open this to the community to see what they think?
PS = This is a multi website setup with a custom store switcher.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来您可能需要打孔。
将带有
根目录的 etc/cache.xml 文件添加到您的模块中。 (请参阅 Enterprise/PageCache/etc/cache.xml)。选择一个唯一的[占位符]名称。placeholders/[placeholder]/block 节点值必须与自定义动态块的 class-id 匹配,例如 mymodule/custom
placeholders/[placeholder]/container 节点值是动态生成内容并处理块级缓存的类
。 placeholders/[placeholder]/placeholder 节点值是一个唯一的字符串,用于标记缓存页面中的动态部分
placeholders/[placeholder]/cache_lifetime 被忽略,指定容器中的一个块缓存生存期
_saveCache()
方法(如果需要)实现容器类并扩展
Enterprise_PageCache_Model_Container_Abstract
。使用_renderBlock()
返回动态内容。在容器中实现 _getCacheId() 方法以启用块级缓存。使用 cookie 值而不是模型 ID(成本较低)。
最后一点:当调用
_renderBlock()
时,您无法使用完整的 Magento 应用程序。尽可能保守。来源:http://tweetorials.tumblr.com/post /10160075026/ee-full-page-cache-hole-punching
Hole punching is what it sounds like you may need.
Add a etc/cache.xml file with a
<config>
root to your module. (see Enterprise/PageCache/etc/cache.xml). Choose a unique [placeholder] name.The placeholders/[placeholder]/block node value must match the class-id of your custom dynamic block, e.g. mymodule/custom
The placeholders/[placeholder]/container node value is the class to generate the content dynamically and handle block level caching
The placeholders/[placeholder]/placeholder node value is a unique string to mark the dynamic parts in the cached page
placeholders/[placeholder]/cache_lifetime is ignored, specify a block cache lifetime in the container’s
_saveCache()
method if neededImplement the container class and extends
Enterprise_PageCache_Model_Container_Abstract
. Use_renderBlock()
to return the dynamic content.Implement the
_getCacheId()
method in the container to enable the block level caching. Use cookie values instead of model ids (lower cost).One last note: You DON’T have the full Magento App at your disposal when
_renderBlock()
is called. Be as conservative as possible.SOURCE: http://tweetorials.tumblr.com/post/10160075026/ee-full-page-cache-hole-punching