【问题标题】:Magento how I refresh block_html cache after product save using programmaticallyMagento如何在产品保存后以编程方式刷新block_html缓存
【发布时间】:2017-02-14 12:46:22
【问题描述】:

我正在尝试在管理端的产品保存/保存并继续后以编程方式刷新 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));
}

但这不起作用。

【问题讨论】:

    标签: magento caching


    【解决方案1】:

    请使用以下代码。它正在工作。见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());
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-02
      • 1970-01-01
      相关资源
      最近更新 更多