我正在使用Magento ver1.6.1.我需要以编程方式清除Magento缓存.
Mage::app()->getCache()->clean()
Run Code Online (Sandbox Code Playgroud)
我使用上面的代码,但它没有清除缓存.
Mag*_*Guy 14
这就是你所追求的:
try {
$allTypes = Mage::app()->useCache();
foreach($allTypes as $type => $blah) {
Mage::app()->getCacheInstance()->cleanType($type);
}
} catch (Exception $e) {
// do something
error_log($e->getMessage());
}
Run Code Online (Sandbox Code Playgroud)
以下是您自动执行此操作的方法:
http://mikebywaters.wordpress.com/2011/12/09/automatically-refresh-magento-cache/
| 归档时间: |
|
| 查看次数: |
14563 次 |
| 最近记录: |