diff options
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); + } } } |