Magento

Magento Hole Punch With Varnish Cache

By April 29, 2017 No Comments

If You want to exclude your custom block from varnish cache then follow below solution.

<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>

We only have one parameter called <access></access>. This parameters indicates to Magento which type of caching we want on the block. In this case, the type of caching is private. private means that we want Varnish to cache a different version of the <block></block> for each client.
If you want to exclude URL then see below solution.

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

Leave a Reply