In the Magento admin under Cache Management, what does it mean when it shows a cache as invalidated? How does Magento know a cache is invalidated? In particular, I'm wondering about HTML Block cache. What conditions would cause this cache to show up as invalidated?
In Magento, whenever you make changes to products, static blocks, etc, it recognizes that the data in the database is no longer the same as what it has in the cache. Unfortunately, Magento doesn't realize what cache data is different, just that something is different.
You will need to go into System > Cache Management and refresh the invalidated cache types.
EDIT:
Create a module (or use an existing module) that you can use to set up a cron job for refreshing the cache. Create a file: {namespace}/{modulename}/Model/Observer.php
Inside that file:
<?php
class <namespace>_<modulename>_Model_Observer {
public function refreshCache() {
try {
$allTypes = Mage::app()->useCache();
foreach($allTypes as $type => $blah) {
Mage::app()->getCacheInstance()->cleanType($type);
}
} catch (Exception $e) {
// do something
error_log($e->getMessage());
}
}
}
In your module's etc/config.xml:
<config>
...
<crontab>
<jobs>
<{modulename}_refresh_cache>
<schedule><cron_expr>* * * * *</cron_expr></schedule>
<run><model>{modulename}/observer::refreshCache</model></run>
</{modulename}_refresh_cache>
</jobs>
</crontab>
...
</config>
Now as long as cron is configured correctly on your server, the cache will update automatically, as often as cron runs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With