【问题标题】:Magento Hole puch With VarnishMagento 打孔器带清漆
【发布时间】:2014-07-11 13:21:32
【问题描述】:

我最近在系统(ubuntu)中安装了varnish 3.x,并将其配置为8080。

现在全页缓存已启用并且工作正常。我只想忽略一些 页面的特定动态块。我怎么能用magento。我也不是 使用 Magento 默认缓存技术,所以我禁用了它。还尝试了模块 Terpentine

感谢和问候

拉杰什·甘吉尔

【问题讨论】:

  • 问题不清楚,您是要关闭特定块的缓存还是要禁用块?
  • 是的,我想关闭特定块的缓存。请建议..这是紧急需求,但没有得到任何帮助..
  • 您是在使用扩展程序在 Magento 中启用 Varnish 支持,还是刚刚在 Web 服务器前安装了 Varnish?禁用 Magento 的块缓存不会做任何事情,因为 Varnish(默认情况下)无论如何都会缓存任何输出。要实现打孔,您需要研究 Edge Side Includes。这些本质上允许您独立控制页面块的缓存策略。有一些扩展可以正确实现这一点。
  • 感谢对这个话题感兴趣的人们。我得到了解决方案。我已经回答了解决方案。

标签: magento varnish hole-punching


【解决方案1】:

我已经这样做了

在 app/design/frontend/XXX/XXX/layout/local.xml 文件中的 local.xml 中试试这个:

<reference name="block name">
    <action method="setEsiOptions">
        <params>
            <access>private</access>
            <flush_events>
                <wishlist_item_save_after/>
                <wishlist_item_delete_after/>
                <sales_quote_save_after/>
                </flush_events>
        </params>
    </action>
</reference>`

<reference name="block name">
    <action method="setEsiOptions">
        <params>
            <access>private</access>
            <ttl>0</ttl>
        </params>
    </action>
</reference>`

<reference name="block name">
<action method="setEsiOptions">
    <params>
        <access>private</access>
        <method>ajax</method>
    </params>
</action>
</reference>`

整个页面将忽略缓存,例如。一页模块 checkout_onepage_index

<checkout_onepage_index>
    <turpentine_cache_flag value="0"/>
</checkout_onepage_index>

我使用 Nexcessnet Turpentine 模块进行了尝试。它有效

Turpentine 安装后供您参考:

app/design/frontend/base/default/layout/turpentine_esi.xml

非常感谢您的反馈。

参考网站:

http://www.magentocommerce.com/magento-connect/turpentine-varnish-cache.html

https://github.com/nexcess/magento-turpentine

感谢和问候

拉杰什·甘吉尔

【讨论】:

    【解决方案2】:

    【讨论】:

      【解决方案3】:

      在 layout.xml 文件中试试这个:

       <reference name="block name">
            <action method="setCacheLifetime"><s>null</s></action>
        </reference>
      

      如果您想在 phtml 文件中禁用,则在块名称后使用 false,如下所示:

      <?php echo $this->getChildHtml('topLinks',false) ?> 
      

      如果您想从 php 文件中禁用,请在特定的 Block 类中使用此代码:

      public function getCacheLifetime() { return null; } 
      

      希望这会有所帮助。万事如意!

      【讨论】:

      • 这只会影响 Magento 的块缓存。清漆缓存不会以这种方式被清除。
      【解决方案4】:

      使用松节油将是可行的方法。

      您正在寻找的具体链接是: https://github.com/nexcess/magento-turpentine/wiki/ESI_Cache_Policy

      细节如下:

      如果没有指定,默认的 ttl 有点复杂:如果访问是 私有,然后如果方法是 ajax 默认 ttl 是 0(不缓存) 否则使用默认的 cookie 过期时间。如果访问是 全局,则使用默认页面 TTL(无论方法如何)。

      实现如下:

      <reference name="block name">
          <action method="setEsiOptions">
              <params>
                  <access>private</access>
                  <ttl>0</ttl>
              </params>
          </action>
      </reference>
      

      【讨论】:

        猜你喜欢
        • 2017-08-05
        • 2017-05-03
        • 2021-02-28
        • 2013-01-05
        • 2013-09-04
        • 2012-06-11
        • 1970-01-01
        • 2019-03-21
        • 1970-01-01
        相关资源
        最近更新 更多