Clear Magento cache

前端 未结 4 2070
清歌不尽
清歌不尽 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 02:41

    If you are using Magento Enterprise (I'm using 1.13), the above code in the aforementioned answers does not seem to be enough to flush the full page cache.

    It took me a while to figure out what was going on, but there are a few methods that fire as a result of events when using the web interface that would not be covered when using the code above. Of critical importance, is the cleanCache method of Enterprise_PageCache_Model_Observer.

    To fix, I added the following code after either Magento Guy or Oğuz Çelikdemir's code.

    Enterprise_PageCache_Model_Cache::getCacheInstance() ->clean(Enterprise_PageCache_Model_Processor::CACHE_TAG);

    Hope this saves someone some time!

提交回复
热议问题