Description
Hi ,
We noticed an issue related to flushing private block cache flushing entire website cache .
We have configured Flush Event action for controller_action_predispatch which is fired on EVERY request. Every time page is dispatched. See Below.
private
<registry_keys>
<current_category/>
</registry_keys>
<flush_events>
<wishlist_item_save_after/>
<wishlist_item_delete_after/>
<sales_quote_save_after/>
<controller_action_predispatch/>
</flush_events>
We have similar configuration for Footer Block.
Note that Header and Footer blocks are part of EVERY page in Magento.
look at the code that actually initiates FLUSH Event. This code is from turpentine extension.
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;
}
}
we can see that turpentine BANS the block by $sessionId which is actually the Frontend Cookie. (Magento assigned cookie for user session)
As a result, even if we want to flush Header and Footer, its actually flushing all pages tagged with "Frontend" cookie.
Please let us know your thoughts .