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

时间:2017-02-14 12:46:22

标签: magento caching

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

ERROR: JVMTI: 101(JVMTI_ERROR_ABSENT_INFORMATION): Cannot Get Local Variable table

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f3faab0cefa, pid=14869, tid=0x00007f3fad251700
#
# JRE version: Java(TM) SE Runtime Environment (8.0_111-b14) (build 1.8.0_111-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.111-b14 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [liblearnAgent.so+0xefa]  callbackException+0x277
#
# Core dump written. Default location: /home/kumard/Desktop/core or core.14869
#
# An error report file with more information is saved as:
# /home/kumard/Desktop/hs_err_pid14869.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
[1]    14869 abort (core dumped)  java -agentlib:learnAgent SimpleThread

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

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

但这不起作用。

1 个答案:

答案 0 :(得分:0)

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