0

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?

1
  • you can do cache management programmatically
    – Raghu
    Aug 26, 2017 at 8:50

2 Answers 2

1
<?php
    include 'app/Mage.php';
    Mage::app();
    ini_set('display_errors', 1);

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

    echo "cleared cache";
?>
7
  • Where is the directory for that? Thank you
    – Yong Park
    Aug 26, 2017 at 8:57
  • root folder ......
    – Raghu
    Aug 26, 2017 at 8:59
  • I know it's in the root folder, but which file do I have to insert this code to?
    – Yong Park
    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.php
    – Raghu
    Aug 26, 2017 at 9:02
  • ok let me know the status
    – Raghu
    Aug 26, 2017 at 9:07
0

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.

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.