-
Notifications
You must be signed in to change notification settings - Fork 326
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
Add cache invalidation for snippet areas #7177
Add cache invalidation for snippet areas #7177
Conversation
src/Sulu/Bundle/SnippetBundle/EventListener/CacheInvalidationSubscriber.php
Outdated
Show resolved
Hide resolved
@@ -74,6 +83,8 @@ public function loadByArea($area, $webspaceKey = null, $locale = null) | |||
$locale = $this->requestAnalyzer->getCurrentLocalization()->getLocale(); | |||
} | |||
|
|||
$this->snippetAreaReferenceStore->add($area); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could let to invalidation of the whole website when a global area snippet is used. Lets discuss this with @chirimoya on thursday.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In summary of our discussion, we will introduce a new parameter to the area configuration in the snippet template, which will determine whether the snippet-area should be excluded from the cache invalidation. By default, the snippet-area will always be invalidated. The only exception is for the automatically created area
, they should not be invalidated, otherwise the old behaviour would be changed.
The decision of whether the invalidation should take place will be integrated into the CacheInvalidationSubscriber. Moreover, the snippet-area will always be included in the reference store. The benefit of this is, that we only have to check in one class if the snippet-area should be invalidated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should target 2.4 for this. as discussed we add a new feature flags for snippets here
src/Sulu/Bundle/SnippetBundle/Tests/Unit/Twig/SnippetAreaTwigExtensionTest.php
Outdated
Show resolved
Hide resolved
39057f3
to
05cc7de
Compare
05cc7de
to
5aca841
Compare
0b19951
to
00cc670
Compare
@Prokyonn please rebase to see if the tests turn green and @alexander-schranz really target that to 2.4? |
2.6 is correct target branch for this. |
@wachterjohannes php 8.0 did fail because of the last week we discussed it and decided that it will be part of 2.6 and not backported to 2.4 |
src/Sulu/Bundle/SnippetBundle/Content/SingleSnippetSelection.php
Outdated
Show resolved
Hide resolved
Co-authored-by: Alexander Schranz <alexander@sulu.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should fix the phpstan issues
What's in this PR?
Invalidate snippet area cache, when the area snippet is modified/removed
Why?
Cache invalidation does not work properly for default area snippets that were updated