I am developig an import module which update product data. To speed up the process, I put index to manual mode.
$processes = Mage::getSingleton('index/indexer')->getProcessesCollection();
$processes->walk('setMode', array(Mage_Index_Model_Process::MODE_MANUAL));
$processes->walk('save');
and after the import is finished, I reindex data and put index mode back to auto
$processes = Mage::getSingleton('index/indexer')->getProcessesCollection();
$processes->walk('reindexAll');
$processes->walk('setMode', array(Mage_Index_Model_Process::MODE_REAL_TIME));
$processes->walk('save');
But I am not sure if I also need to clear cache. So my question is how index and cache are related. For example if I clear cache, does it also reindex all data? And on the other site, if I reindex all data, does it clear cache? Or do I need to trigger everytime both processes if I have index mode set to manual? I am not quite sure about this, I hope anybody could confirm it for sure.
Thank you
Magentos
System -> Cache ManagmentandSystem -> Index Managmentare both stand-alone features. If you rebuild such index, no matter whether thru backend or directly usingreindexAll(), Magento will not automatically refresh any cache and vice versa.The answer to
Do I need both?(caches and indexes) is: it depends.If you’re running Magento with caches
COLLECTION_DATAand/orEAVenabled, you should refresh those caches after importing and reindexing product data.The refreshing is necessary because your importer has updated/inserted product data which the caches are not aware of, but not, because you’ve reindexed.
If you’re running Magento with all caches disabled, you don’t need both. Technically, there is no need to refresh disabled cache. Magento would be slower of course, but still be fully functional.