GordonLesti / Lesti_Fpc

Simple Magento Fullpagecache
https://gordonlesti.com/lesti-fpc-documentationversion-1-4-5/
Other
358 stars 159 forks source link

n98-magerun Does Not Flush Cache (Redis) #250

Closed sprankhub closed 8 years ago

sprankhub commented 8 years ago

Thanks for your awesome extension!

I have an issue which may be related to Lesti_Fpc. It is basically described in a n98-magerun issue (and a related issue). When using Redis, a n98-magerun.phar cache:flush does not fully clear the cache. In the linked issue, specifically here Tom says that this seems to be related to your extension. Could you please have a look and check?

Thanks again!

emateu commented 8 years ago

I have the same problem, not sure why.

A quick solution for me was manually adding \Mage::getSingleton('fpc/fpc')->getFrontend()->clean('all') to my own script.

Seems that n98-magerun is not triggering (not sure if should) Lesti_Fpc_Model_Observer_Clean::controllerActionPredispatchAdminhtmlCacheMassRefresh

Also when I clean programmatically caches (code below), Lesti_Fpc is not cleaned too:

$allTypes = \Mage::app()->useCache();
foreach($allTypes as $type => $blah) {
    \Mage::app()->getCacheInstance()->cleanType($type);
    \Mage::dispatchEvent('adminhtml_cache_refresh_type', array('type' => $type));
}

Hope this information helps. I'm using Redis.

GordonLesti commented 8 years ago

Hello @sprankhub yes, I guess FPC should maybe use event application_clean_cache.

sprankhub commented 8 years ago

@GordonLesti could you already have a deeper look at this issue?

GordonLesti commented 8 years ago

Hello @sprankhub as mentioned above I guess FPC listening to the event application_clean_cache should fix this BUG. But unfortunately I have just limited time at the moment to fix this (Cruciate ligament). What about, I try to fix this in a extra branch and you may test it?

sprankhub commented 8 years ago

Sure. If you implement it, I am happy to test and to give you feedback.

ktomk commented 8 years ago

In case Magerun misses to call/trigger the "application_clean_cache" event, and you need this for testing the fix (e.g. from CLI as well next to Mageto Adminhtml) you can ping me anytime and I can put it into the development (unstable) version for an easy test.

GordonLesti commented 8 years ago

I made a small research. Here a list of all events that are dispatched when running the command n98-magerun.phar cache:flush:

I guess the best candidate is adminhtml_cache_flush_all. It is also dispatched in Mage_Adminhtml_CacheController::flushAllAction.

sprankhub commented 8 years ago

Thanks! Sounds reasonable :+1:

ktomk commented 8 years ago

Great news!