Every single time I am trying to upload a few photos, the Cache says "One or more of the Cache Types are invalidated: Blocks HTML output. Click here to go to Cache Management and refresh cache types." I know that you can go in and select all to refresh or flush, but if I try to go to the cache management page or any page in the website, a white page saying "This page isn’t working" pops up until I clear the cache through cpanel FTP or wait for a good few minutes to reload the page. Is there any solution to this?
2 Answers
<?php include 'app/Mage.php'; Mage::app(); ini_set('display_errors', 1); Mage::app()->getCacheInstance()->flush(); echo "cleared cache"; ?> -
- I know it's in the root folder, but which file do I have to insert this code to?Yong Park– Yong Park2017-08-26 09:00:47 +00:00Commented Aug 26, 2017 at 9:00
- you have to create a new file for this ex: clearcache.php in browser you have to run website.com/clearcache.phpRaghu– Raghu2017-08-26 09:02:25 +00:00Commented Aug 26, 2017 at 9:02
-
- I have to upload few more image to check if it works so I'll let you know the status in a day or two. Thanks once again. I will let you know!Yong Park– Yong Park2017-08-26 09:48:38 +00:00Commented Aug 26, 2017 at 9:48
Answering the question assuming you are using Magento 1.
Check function invalidateType in file app/code/core/Mage/Core/Model/Cache.php
This function marks the cache as invalidated. You can hook the code of this function to clean the cache instead of marking it as invalidated.
I hope it will help.