diff options
author | Joas Schilling <coding@schilljs.com> | 2023-08-28 14:59:54 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-08-28 14:59:54 +0200 |
commit | daac5c9a954de4f86135d1d16e8c4a090c29d75f (patch) | |
tree | 8da7751e015bab4bdbd9e7c758be4862857525e2 /lib/private/User/DisplayNameCache.php | |
parent | c2d55ab5f6284313a999c4d71224c0401f04edd4 (diff) | |
download | nextcloud-server-daac5c9a954de4f86135d1d16e8c4a090c29d75f.tar.gz nextcloud-server-daac5c9a954de4f86135d1d16e8c4a090c29d75f.zip |
fix(cache): Remove displayname cache entry on delete
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/User/DisplayNameCache.php')
-rw-r--r-- | lib/private/User/DisplayNameCache.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/private/User/DisplayNameCache.php b/lib/private/User/DisplayNameCache.php index 5d1cc8940d7..6ee74cc9f6c 100644 --- a/lib/private/User/DisplayNameCache.php +++ b/lib/private/User/DisplayNameCache.php @@ -29,6 +29,7 @@ use OCP\ICache; use OCP\ICacheFactory; use OCP\IUserManager; use OCP\User\Events\UserChangedEvent; +use OCP\User\Events\UserDeletedEvent; /** * Class that cache the relation UserId -> Display name @@ -81,5 +82,10 @@ class DisplayNameCache implements IEventListener { $this->cache[$userId] = $newDisplayName; $this->memCache->set($userId, $newDisplayName, 60 * 10); // 10 minutes } + if ($event instanceof UserDeletedEvent) { + $userId = $event->getUser()->getUID(); + unset($this->cache[$userId]); + $this->memCache->remove($userId); + } } } |