PHOENIX-MEDIA / Magento-PageCache-powered-by-Varnish

Community version which is available on Magento Connect (http://www.magentocommerce.com/magento-connect/pagecache-powered-by-varnish.html)
89 stars 49 forks source link

[Feature Request] Only Purge Category/Product page when product QTY reaches 0 #11

Open MikeParkin opened 9 years ago

MikeParkin commented 9 years ago

Hi there,

We've got a few websites using this module, which works brilliantly.

The only issue we have with it is during sale time, where we can get some performance problems with cache thrashing.

During a sale we would normally have lots of products moved to a top level category called Sale (so for example Sale/Men, Sale/Women, Sale/Men/Shirts... etc etc.)

This issue this presents is that during high load, any sale of a product causes the cache to be cleaned all the way up to the top category "Sale" - which means this page is constantly being knocked out of the cache and re-generated.

Would it be possible to build in a way to only clear the cache for product page/categories if the "isSaleable" or similar changes?

Thanks Mike

PHOENIX-MEDIA commented 9 years ago

The module listens on cataloginventory_stock_item_save_after and calls Phoenix_VarnishCache_Model_Observer::purgeCatalogProductByStock. I'm sure this can be easily adjusted for your needs.