Clear Magento cache

前端 未结 4 2047
清歌不尽
清歌不尽 2021-01-03 02:25

I am using Magento ver1.6.1. I need to clear Magento cache programmatically.

Mage::app()->getCache()->clean()

I used the above code b

4条回答
  •  借酒劲吻你
    2021-01-03 03:00

    This is what you're after:

      try {
        $allTypes = Mage::app()->useCache();
        foreach($allTypes as $type => $blah) {
          Mage::app()->getCacheInstance()->cleanType($type);
        }
      } catch (Exception $e) {
        // do something
        error_log($e->getMessage());
      }
    

    Here's how you would do it automatically:

    http://mikebywaters.wordpress.com/2011/12/09/automatically-refresh-magento-cache/

提交回复
热议问题