问题
I recently installed the varnish 3.x in system (ubuntu) and configured it to 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. Also i am not using Magentos default caching techniques so i disabled it. also tried module Terpentine
Thanks & Regard
Rajesh Ganjeer
回答1:
I have done this using
Try this in local.xml inside the app/design/frontend/XXX/XXX/layout/local.xml file:
<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>
<turpentine_cache_flag value="0"/>
</checkout_onepage_index>
I tried this using module Nexcessnet Turpentine. and it works
For your reference after Turpentine installation :
app/design/frontend/base/default/layout/turpentine_esi.xml
Thanks a lot for your feedbacks.
Reference Sites :
http://www.magentocommerce.com/magento-connect/turpentine-varnish-cache.html
https://github.com/nexcess/magento-turpentine
Thanks & Regards
Rajesh Ganjeer
回答2:
Follow this to start to end solutions for varnish
http://rajeshganjeer.wordpress.com/2014/05/28/varnish-with-magento-terpentine/
回答3:
Try this in layout.xml file:
<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:
<?php echo $this->getChildHtml('topLinks',false) ?>
and if you want to disable from php file then use this code in specific Block class:
public function getCacheLifetime() { return null; }
Hope this helps. All the best!
回答4:
Using Turpentine will be the way to go.
The specific link you are looking for is to: 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. If access is global then the default page TTL is used (regardless of method).
Implemented like:
<reference name="block name">
<action method="setEsiOptions">
<params>
<access>private</access>
<ttl>0</ttl>
</params>
</action>
</reference>
来源:https://stackoverflow.com/questions/23807938/magento-hole-puch-with-varnish