bigbridge-nl / product-import

Fast product import library for Magento 2
MIT License
113 stars 32 forks source link

Clear Cache after change per product ID #50

Open chrisastley opened 2 years ago

chrisastley commented 2 years ago

Hi,

I was looking at a way for your module to clear Cache of a product if a change it processed for it.

I found this info that details a procedure to clear Cache for a product ID and to purge varnish. https://stackoverflow.com/questions/42627051/how-do-i-clear-the-cache-in-magento-2-for-a-single-product-id

At the moment if I automate a change it can take up to 24 hours to show if the product page is already cached and I don't like clearing the whole cache.

garfix commented 2 years ago

I developed this library for BigBridge, but I left the company recently. My former colleagues will continue to maintain it.

As for your request, I could make this suggestion: the library works best if the product indexes are set to "Update by Schedule". If this is the case then database triggers, together with an active cron will take care of both partial reindexing and selective cache clearing of the affected products and their categories. This has always worked for me.

see also https://www.bigbridge.nl/blog/essential-magento-2-partial-reindexing/