0

We have installed Varnish v4 on our server to improve the Magento response time (we have installed the Turpentine extension as well to manage varnish). I am currently working on excluding cache for certain blocks however nothing is working for me.

In the before_body_end, I have this code:

    <reference name="before_body_end">
                <block type="core/template" name="compare.products" 
                        template="page/html/compare-products.phtml" /> 
    </reference>

I have modified the turpentine_esi.xml and added the following code which to me seems correct however the block is still being cached:

<default>       
         <reference name="compare.products" type="core/template">           
             <action method="setEsiOptions">
                <params>
                    <access>private</access>
                </params>
                <flush_events>
                    <catalog_product_compare_add_product/>
                    <catalog_product_compare_remove_product/>
                    <catalog_product_compare_item_collection_clear/>
                </flush_events>             
             </action>      
          </reference>
<default>       

Is someone able to point me in the right direction? I am currently at a loss to why this code is not working.

1 Answer 1

0

With those ESI policies you're setting the block to be cached privately via ESI. In other words, each user will have their own version of the block cached in Varnish. That may actually be what you want.

You can verify this is working by looking at the source code of the page - you should see some HTML comments before and after the compare.products block.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.