Dmitry  Antonenko
Dmitry Antonenko

Reputation: 33

Disabling cache for Magento Block in APC

I'm using Magento CE v.1.9.0, with APC cache installed. I need to disable cache for block output, but, unfortunately, standart solution isn't working for me:

    $this->addData(array(
            'cache_lifetime' => 0,
            'cache_key'      => Mage::registry('current_product')->getId() . '_testcache',
        ));

Block still being cached. Any advices, how can I do this, without implementing sick AJAX solutions? Thank you.

Upvotes: 0

Views: 212

Answers (2)

Aitoc
Aitoc

Reputation: 16

The easiest way to do this is by enacting setCacheLifetime on the current block.

So, you need to set lifetime to 0 or null (0 is a more correct way) in the current layout file.

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

Upvotes: 0

subroutines
subroutines

Reputation: 1458

You could try disabling it via one of your layout xmls.

<reference name="block_name">            
  <action method="unsetData"><key>cache_lifetime</key></action>
</reference>

Upvotes: 1

Related Questions