If you are running Magento scripts that are bootstrapped for reasons such as asynchronous processing, syncs, indexing, etc, then you’ll want to disable all Magento cache when Magento is loaded. This will avoid cases where old model data is being used, especially when you have two executions of the Magento script running at the same time.
To disable all Magento cache programmatically add the “global_ban_use_cache” option to your Mage::app initialization. Your Mage::app initialization would look like this:
Mage::app(‘admin’, ‘store’, array(‘global_ban_use_cache’=>true));
Any modules you have running that also use the native Magento cache system should also stop using cache when this flag is set.
Hope this helps some people!
Exactly the code I needed today!
thx Jay!
When enabling again you may need to Re-init the cache:
Mage::getConfig()->getOptions()->setData(‘global_ban_use_cache’, FALSE);
Mage::app()->baseInit(array()); // Re-init cache
When will you visit us in Switzerland?
Cheers Rafi