app/code/community/Nexcessnet/Turpentine/Model/Observer/Ban.php
public function banClientEsiCache($eventObject) {
        $eventName = $eventObject->getEvent()->getName();
        if (Mage::helper('turpentine/esi')->getEsiEnabled() &&
                ! in_array($eventName, $this->_esiClearFlag)) {
            $sessionId = Mage::app()->getRequest()->getCookie('frontend');
            if ($sessionId) {
                $result = $this->_getVarnishAdmin()->flushExpression(
                    'obj.http.X-Varnish-Session', '==', $sessionId,
                    '&&', 'obj.http.X-Turpentine-Flush-Events', '~',
                    $eventName );
                Mage::dispatchEvent('turpentine_ban_client_esi_cache', $result);
                if ($this->_checkResult($result)) {
                    Mage::helper('turpentine/debug')
                        ->logDebug('Cleared ESI cache for client (%s) on event: %s',
                            $sessionId, $eventName);
                } else {
                    Mage::helper('turpentine/debug')
                        ->logWarn(
                            'Failed to clear Varnish ESI cache for client: %s',
                            $sessionId );
                }
            }
            $this->_esiClearFlag[] = $eventName;
        }
    }
public function banClientEsiCache($eventObject) {
        $eventName = $eventObject->getEvent()->getName();
        if (Mage::helper('turpentine/esi')->getEsiEnabled() &&
                ! in_array($eventName, $this->_esiClearFlag)) {
            $sessionId = Mage::app()->getRequest()->getCookie('frontend');
            if ($sessionId) {
                $result = $this->_getVarnishAdmin()->flushExpression(
                    'obj.http.X-Varnish-Session', '==', $sessionId,
                    '&&', 'obj.http.X-Turpentine-Flush-Events', '~',
                    $eventName );
                Mage::dispatchEvent('turpentine_ban_client_esi_cache', $result);
                if ($this->_checkResult($result)) {
                    Mage::helper('turpentine/debug')
                        ->logDebug('Cleared ESI cache for client (%s) on event: %s',
                            $sessionId, $eventName);
                } else {
                    Mage::helper('turpentine/debug')
                        ->logWarn(
                            'Failed to clear Varnish ESI cache for client: %s',
                            $sessionId );
                }
            }
            $this->_esiClearFlag[] = $eventName;
        }
    }
public function banClientEsiCache ( $ eventObject ) { $ eventName = $ eventObject -> getEvent ( ) -> getName ( ) ; if ( Mage :: helper ( 'turpentine/esi' ) -> getEsiEnabled ( ) && ! in_array ( $ eventName , $ this -> _esiClearFlag ) ) { $ sessionId = Mage :: app ( ) -> getRequest ( ) -> getCookie ( 'frontend' ) ; if ( $ sessionId ) { $ result = $ this -> _getVarnishAdmin ( ) -> flushExpression ( 'obj.http.X-Varnish-Session' , '==' , $ sessionId , '&&' , 'obj.http.X-Turpentine-Flush-Events' , '~' , $ eventName ) ; Mage :: dispatchEvent ( 'turpentine_ban_client_esi_cache' , $ result ) ; if ( $ this -> _checkResult ( $ result ) ) { Mage :: helper ( 'turpentine/debug' ) -> logDebug ( 'Cleared ESI cache for client (%s) on event: %s' , $ sessionId , $ eventName ) ; } else { Mage :: helper ( 'turpentine/debug' ) -> logWarn ( 'Failed to clear Varnish ESI cache for client: %s' , $ sessionId ) ; } } $ this -> _esiClearFlag [ ] = $ eventName ; } }
Clear the ESI block cache for a specific client

Events:
the events are applied dynamically according to what events are set
for the various blocks' esi policies

@param  Varien_Object $eventObject
@return null
Clear the ESI block cache for a specific client