app/code/community/Nexcessnet/Turpentine/Model/Observer/Ban.php
public function banProductPageCacheCheckStock($eventObject) {
        if (Mage::helper('turpentine/varnish')->getVarnishEnabled()) {
            $item = $eventObject->getItem();
            if ($item->getStockStatusChangedAutomatically() ||
                    ($item->getOriginalInventoryQty() <= 0 &&
                        $item->getQty() > 0 &&
                        $item->getQtyCorrection() > 0)) {
                $banHelper = Mage::helper('turpentine/ban');
                $cronHelper = Mage::helper('turpentine/cron');
                $product = Mage::getModel('catalog/product')
                    ->load($item->getProductId());
                $urlPattern = $banHelper->getProductBanRegex($product);
                $result = $this->_getVarnishAdmin()->flushUrl($urlPattern);
                Mage::dispatchEvent('turpentine_ban_product_cache_check_stock',
                    $result);
                if ($this->_checkResult($result) &&
                        $cronHelper->getCrawlerEnabled()) {
                    $cronHelper->addProductToCrawlerQueue($product);
                    foreach ($banHelper->getParentProducts($product)
                            as $parentProduct) {
                        $cronHelper->addProductToCrawlerQueue($parentProduct);
                    }
                }
            }
        }
    }
public function banProductPageCacheCheckStock($eventObject) {
        if (Mage::helper('turpentine/varnish')->getVarnishEnabled()) {
            $item = $eventObject->getItem();
            if ($item->getStockStatusChangedAutomatically() ||
                    ($item->getOriginalInventoryQty() <= 0 &&
                        $item->getQty() > 0 &&
                        $item->getQtyCorrection() > 0)) {
                $banHelper = Mage::helper('turpentine/ban');
                $cronHelper = Mage::helper('turpentine/cron');
                $product = Mage::getModel('catalog/product')
                    ->load($item->getProductId());
                $urlPattern = $banHelper->getProductBanRegex($product);
                $result = $this->_getVarnishAdmin()->flushUrl($urlPattern);
                Mage::dispatchEvent('turpentine_ban_product_cache_check_stock',
                    $result);
                if ($this->_checkResult($result) &&
                        $cronHelper->getCrawlerEnabled()) {
                    $cronHelper->addProductToCrawlerQueue($product);
                    foreach ($banHelper->getParentProducts($product)
                            as $parentProduct) {
                        $cronHelper->addProductToCrawlerQueue($parentProduct);
                    }
                }
            }
        }
    }
public function banProductPageCacheCheckStock ( $ eventObject ) { if ( Mage :: helper ( 'turpentine/varnish' ) -> getVarnishEnabled ( ) ) { $ item = $ eventObject -> getItem ( ) ; if ( $ item -> getStockStatusChangedAutomatically ( ) || ( $ item -> getOriginalInventoryQty ( ) <= 0 && $ item -> getQty ( ) > 0 && $ item -> getQtyCorrection ( ) > 0 ) ) { $ banHelper = Mage :: helper ( 'turpentine/ban' ) ; $ cronHelper = Mage :: helper ( 'turpentine/cron' ) ; $ product = Mage :: getModel ( 'catalog/product' ) -> load ( $ item -> getProductId ( ) ) ; $ urlPattern = $ banHelper -> getProductBanRegex ( $ product ) ; $ result = $ this -> _getVarnishAdmin ( ) -> flushUrl ( $ urlPattern ) ; Mage :: dispatchEvent ( 'turpentine_ban_product_cache_check_stock' , $ result ) ; if ( $ this -> _checkResult ( $ result ) && $ cronHelper -> getCrawlerEnabled ( ) ) { $ cronHelper -> addProductToCrawlerQueue ( $ product ) ; foreach ( $ banHelper -> getParentProducts ( $ product ) as $ parentProduct ) { $ cronHelper -> addProductToCrawlerQueue ( $ parentProduct ) ; } } } } }
Ban a product page from the cache if it's stock status changed

Events:
cataloginventory_stock_item_save_after

@param  Varien_Object $eventObject
@return null
Ban a product page from the cache if it s stock status changed