简体   繁体   English

在magento(企业)中从全页缓存(FPC)禁用缓存请求的最佳实践是什么

[英]What is the best practice for disabling a cache request from the Full Page Cache (FPC) in magento (enterprise)

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). ...来自core / Enterprise / PageCache / config.xml文件的config.xml中,因此不会缓存主页(因为我们有一个复杂的自定义存储开关)。

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. 由于此值未存储在core_config_data中,因此我不确定覆盖开箱即用值的最佳方法。 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. PS =这是带有自定义商店切换器的多网站设置。

Hole punching is what it sounds like you may need. 听起来像您可能需要打孔。

Add a etc/cache.xml file with a <config> root to your module. 将具有<config>根的etc / cache.xml文件添加到模块中。 (see Enterprise/PageCache/etc/cache.xml). (请参阅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, eg mymodule/custom 占位符/ [placeholder] / block节点的值必须与您的自定义动态块的class-id匹配,例如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 needed placeholders / [placeholder] / cache_lifetime被忽略,如果需要,在容器的_saveCache()方法中指定块缓存生存期

Implement the container class and extends Enterprise_PageCache_Model_Container_Abstract . 实现容器类并扩展Enterprise_PageCache_Model_Container_Abstract Use _renderBlock() to return the dynamic content. 使用_renderBlock()返回动态内容。

Implement the _getCacheId() method in the container to enable the block level caching. 在容器中实现_getCacheId()方法以启用块级缓存。 Use cookie values instead of model ids (lower cost). 使用Cookie值代替模型ID(费用较低)。

One last note: You DON'T have the full Magento App at your disposal when _renderBlock() is called. 最后一点:调用_renderBlock()时,您将无法使用完整的Magento应用程序。 Be as conservative as possible. 尽可能保守。

SOURCE: http://tweetorials.tumblr.com/post/10160075026/ee-full-page-cache-hole-punching 消息来源: http//tweetorials.tumblr.com/post/10160075026/ee-full-page-cache-hole-punching

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM