简体   繁体   English

Magento Hole puch与清漆

[英]Magento Hole puch With Varnish

I recently installed the varnish 3.x in system (ubuntu) and configured it to 8080. 我最近在系统(ubuntu)中安装了清漆3.x并将其配置为8080。

Now full page caching is enabled and its working fine. 现在启用了整页缓存,其工作正常。 I just want to ignore some specific dynamic blocks of the page. 我只是想忽略页面的一些特定动态块。 How can i do with magento. 我怎么能用magento做。 Also i am not using Magentos default caching techniques so i disabled it. 此外,我没有使用Magentos默认缓存技术,所以我禁用它。 also tried module Terpentine 还试过模块Terpentine

Thanks & Regard 谢谢和注意

Rajesh Ganjeer Rajesh Ganjeer

I have done this using 我这样做了

Try this in local.xml inside the app/design/frontend/XXX/XXX/layout/local.xml file: 在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>`

OR 要么

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

OR 要么

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

OR 要么

Whole page will ignore cached eg. 整个页面将忽略缓存,例如。 one page module checkout_onepage_index 一页模块checkout_onepage_index

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

I tried this using module Nexcessnet Turpentine. 我尝试使用模块Nexcessnet Turpentine。 and it works 它的工作原理

For your reference after Turpentine installation : 在Turpentine安装后供您参考:

app/design/frontend/base/default/layout/turpentine_esi.xml 应用程序/设计/前端/碱/默认/布局/ turpentine_esi.xml

Thanks a lot for your feedbacks. 非常感谢您的反馈。

Reference Sites : 参考站点:

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

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

Thanks & Regards 感谢和问候

Rajesh Ganjeer Rajesh Ganjeer

Try this in layout.xml file: 在layout.xml文件中尝试此操作:

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

if you want to disable in phtml file then use false after block name like this: 如果要在phtml文件中禁用,则在块名后使用false,如下所示:

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

and if you want to disable from php file then use this code in specific Block class: 如果你想从php文件禁用,那么在特定的Block类中使用此代码:

public function getCacheLifetime() { return null; } 

Hope this helps. 希望这可以帮助。 All the best! 祝一切顺利!

Using Turpentine will be the way to go. 使用Turpentine将是最佳选择。

The specific link you are looking for is to: https://github.com/nexcess/magento-turpentine/wiki/ESI_Cache_Policy 您要查找的具体链接是: https//github.com/nexcess/magento-turpentine/wiki/ESI_Cache_Policy

With the detail being: 细节是:

The default ttl if not specified is a little complex: If access is private, then if method is ajax the default ttl is 0 (not cached) otherwise the default cookie expiration time is used. 如果未指定,则默认ttl有点复杂:如果access是private,则如果method是ajax,则默认ttl为0(未缓存),否则使用默认cookie到期时间。 If access is global then the default page TTL is used (regardless of method). 如果访问是全局的,则使用默认页面TTL(无论方法如何)。

Implemented like: 实施如下:

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

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

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