简体   繁体   English

在APC中禁用Magento块的缓存

[英]Disabling cache for Magento Block in APC

I'm using Magento CE v.1.9.0, with APC cache installed. 我正在使用Magento CE v.1.9.0,并已安装APC缓存。 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? 有什么建议,如何在不实施不良的AJAX解决方案的情况下做到这一点? Thank you. 谢谢。

You could try disabling it via one of your layout xmls. 您可以尝试通过布局xml之一禁用它。

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

The easiest way to do this is by enacting setCacheLifetime on the current block. 最简单的方法是在当前块上设置setCacheLifetime。

So, you need to set lifetime to 0 or null (0 is a more correct way) in the current layout file. 因此,您需要在当前布局文件中将生存期设置为0或null(0是更正确的方法)。

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

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

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