Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flushing private cache flushe entire website cache #1504

Open
rameshramachandran84-zz opened this issue Aug 29, 2018 · 6 comments
Open

flushing private cache flushe entire website cache #1504

rameshramachandran84-zz opened this issue Aug 29, 2018 · 6 comments

Comments

@rameshramachandran84-zz

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 .

@rameshramachandran84-zz
Copy link
Author

@miguelbalparda : please share your thoughts

@rameshramachandran84-zz
Copy link
Author

@eth8505 : please check

@rameshramachandran84-zz
Copy link
Author

Hi, We identified the root cause. the flush events associated with each block is not only flushing the block cache, it is flushing the entire website cache and this is causing issues . As per the Doc its mentioned that cache will only flush for the particular blocks not for the entire pages.

@miguelbalparda
Copy link
Contributor

Would you mind doing a PR with your findings?

@rameshramachandran84-zz
Copy link
Author

@miguelbalparda : Can you please get me some idea about the BAN functionality . Is the BAN will flush entire page cache or its only flush particular block cache?

@rameshramachandran84-zz
Copy link
Author

@miguelbalparda @aricwatson:

<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>

the above code added for the header block . So how can we confirm the ban request will only clear the header block cache not the full page cache . Is there any to make sure this . Please let me know .

@miguelbalparda miguelbalparda added old-invalid Issues created before 2018-01-01. Will close en mass on Feb 15. and removed old-invalid Issues created before 2018-01-01. Will close en mass on Feb 15. labels Feb 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants