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

clearCachePostProc hook repeats calls #2505

Open
heifiDR opened this issue Jul 22, 2024 · 1 comment
Open

clearCachePostProc hook repeats calls #2505

heifiDR opened this issue Jul 22, 2024 · 1 comment

Comments

@heifiDR
Copy link

heifiDR commented Jul 22, 2024

Bug Report

Current Behavior
When the clearCachePostProc() in the DataHandlerHook is called, it always writes 2 entries to the $cacheTagsToFlush array. It then loops through the array and executes $cacheManager->flushCachesInGroupByTag(). Because the class is a singleton, the $cacheTagsToFlush array is never deleted. This means that when another news item is deleted, the cache for all previous items is emptied again.

With 115 deleted news elements, that are on the same page, the $cacheManager->flushCachesInGroupByTag() call occurs over 6600 times.

Expected behavior/output
The $cacheManager->flushCachesInGroupByTag() should just be called once per item and page.

Environment

  • TYPO3 version(s): [11, 12]
  • news version: [10.0.3, 11.4.2]
  • Is your TYPO3 installation set up with Composer (Composer Mode): [yes]

Possible Solution
There are different ways to solve this. The fastest solution could be to reset the $cacheTagsToFlush array on each hook call, but this would still trigger multiple calls for the same page. The cleanest approach would probably be to collect alle $cacheTagsToFlush in an earlier hook and to clear it in the clearCachePostProc() Hook.

@georgringer
Copy link
Owner

wanna provide a PR to improve the situation? last suggestion looks best

heifiDR added a commit to heifiDR/news that referenced this issue Jul 26, 2024
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