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

Add caching to navigation and snippet controller #112

Merged
merged 5 commits into from Jun 10, 2022

Conversation

Prokyonn
Copy link
Member

@Prokyonn Prokyonn commented Jun 9, 2022

Add caching and tag invalidation support for NavigationController and SnippetAreaController

Copy link
Member

@alexander-schranz alexander-schranz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a subscriber which invalidates snippet areas.

Comment on lines 33 to 34
// 7 days
public const NAVIGATION_CACHE_LIFE_TIME = '604800';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be configureable.

Controller/NavigationController.php Outdated Show resolved Hide resolved
Comment on lines 35 to 36
// 7 days
public const SNIPPET_AREA_CACHE_LIFE_TIME = '604800';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be configureable.

Controller/SnippetAreaController.php Outdated Show resolved Hide resolved
EventSubscriber/NavigationInvalidationSubscriber.php Outdated Show resolved Hide resolved
Comment on lines 71 to 74
Events::PUBLISH => ['invalidateNavigationContextBeforePublishing', 8192],
Events::UNPUBLISH => ['invalidateNavigationContextBeforeUnpublishing', 8192],
Events::REMOVE => ['invalidateNavigationContextBeforeRemoving', 8192],
Events::REMOVE_LOCALE => ['invalidateNavigationContextBeforeRemovingLocale', 8192],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This listeners should just collect the data.

And a Flush method with allow priority should then call the CacheManager.

Do not forget to implement kernel.reset event to empty the array and empty the array.

@Prokyonn
Copy link
Member Author

Prokyonn commented Jun 9, 2022

Missing a subscriber which invalidates snippet areas.

@alexander-schranz do we really need one?

At the moment it is working, as soon as the snippet is modified, the tag is invalidated through the default InvalidationSubscriber from the HttpCacheBundle

@alexander-schranz
Copy link
Member

@Prokyonn but if a default snippet is changed to another default snippet the cache need to be invalided also. Else you will get a long time the old default snippet.

*
* @internal
*/
class NavigationInvalidationSubscriber implements EventSubscriberInterface
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would add the ResetInterface here.

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

Successfully merging this pull request may close these issues.

None yet

2 participants