From ec52c25fe14418748638d601c1015424c654e6dd Mon Sep 17 00:00:00 2001 From: Lukas Eichenauer Date: Wed, 6 May 2026 13:44:03 +0200 Subject: [PATCH] News: Fix cache invalidation See: https://mantis.ilias.de/view.php?id=47761 --- components/ILIAS/News/src/Domain/NewsCollectionService.php | 2 +- components/ILIAS/News/src/Persistence/NewsCache.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/ILIAS/News/src/Domain/NewsCollectionService.php b/components/ILIAS/News/src/Domain/NewsCollectionService.php index 4e162162a5b0..198e8fde42ed 100644 --- a/components/ILIAS/News/src/Domain/NewsCollectionService.php +++ b/components/ILIAS/News/src/Domain/NewsCollectionService.php @@ -93,7 +93,7 @@ public function getNewsForContext( public function invalidateCache(int $user_id): void { - $this->cache->invalidateNewsForUser($user_id, new NewsCriteria()); + $this->cache->invalidateNewsForUser($user_id); } /** diff --git a/components/ILIAS/News/src/Persistence/NewsCache.php b/components/ILIAS/News/src/Persistence/NewsCache.php index 57c6ebcae32f..44667ea4385b 100644 --- a/components/ILIAS/News/src/Persistence/NewsCache.php +++ b/components/ILIAS/News/src/Persistence/NewsCache.php @@ -193,13 +193,14 @@ public function storeNewsForUser(int $user_id, NewsCriteria $criteria, NewsColle $this->il_cache->storeEntry( $this->generateL3Key($user_id, $criteria), - serialize($news->getUserReadStatus($user_id)) + serialize($news->getUserReadStatus($user_id)), + $user_id ); } - public function invalidateNewsForUser(int $user_id, NewsCriteria $criteria): void + public function invalidateNewsForUser(int $user_id): void { - $this->il_cache->deleteEntry($this->generateL3Key($user_id, $criteria)); + $this->il_cache->deleteByAdditionalKeys($user_id); } protected function generateL3Key(int $user_id, NewsCriteria $criteria): string