繁体   English   中英

Magento如何在以编程方式保存产品后刷新block_html缓存

[英]Magento how I refresh block_html cache after product save using programmatically

我正在尝试在产品保存/保存并在管理端继续后以编程方式刷新Magento缓存。 我已经试过了

Mage::app()->getCacheInstance()->cleanType('block_html'); 

目录产品保存事件后观察者。我也试试

foreach($types as $type) {

$c = Mage::app()->getCacheInstance()->cleanType($type);

Mage::dispatchEvent('adminhtml_cache_refresh_type', array('type' => $type));
}

但这不起作用。

请使用以下代码。 它正在发挥作用。 请参阅http://www.magebuzz.com/blog/magento-clear-cache-programmatically/

try {
      $type = 'block_html';
      Mage::app()->getCacheInstance()->cleanType($type);

} catch (Exception $e) {
      Mage::log($e->getMessage());
}

暂无
暂无

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

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