0

What is the code for clean or refresh the cache programmatically because I have got lots of snippets but all are not working in Magento 1 enterprise edition.

Does anyone know how to solve it? Thanks in advance.

  • Did you resolve you issue? – Shoaib Munir Nov 6 at 15:56
0

To clean cache use this:

Mage::app()->cleanCache();

To flush cache use this:

Mage::app()->getCacheInstance()->flush(); 

You can also use this if you are trying to flush specific cache:

$tags = Mage::app()->getCacheInstance()->cleanType($type);
Mage::dispatchEvent('adminhtml_cache_refresh_type', array('type' => $type));

Possible types are as follows:

  1. config
  2. layout
  3. block_html
  4. translate
  5. collections
  6. eav
  7. config_api
  8. config_api2
  9. full_page

Reference: How can I programmatically flush Magento's Cache?

Note: You might face problem if you are doing it on frontend. Make sure you do it on admin area.

  • will it work on Magento 1 EE? because I have tried but the cache has been not refreshed and the changes are not displayed on frontend.. – Naresh Prajapati Nov 5 at 13:26
  • Yes this should work. However if your changes still refreshed on frontend, then check by manual flushing cache, check if changes still appearing on frontend or not. May be the issue is with something else. – Shoaib Munir Nov 5 at 18:19
  • But try this code first – Shoaib Munir Nov 5 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.