File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 2424 * @template-implements IEventListener<UserChangedEvent|UserDeletedEvent>
2525 */
2626class DisplayNameCache implements IEventListener {
27+ private const CACHE_TTL = 24 * 60 * 60 ; // 1 day
28+
2729 /** @see \OC\Config\UserConfig::USER_MAX_LENGTH */
2830 public const MAX_USERID_LENGTH = 64 ;
2931 private array $ cache = [];
@@ -57,7 +59,7 @@ public function getDisplayName(string $userId): ?string {
5759 $ displayName = null ;
5860 }
5961 $ this ->cache [$ userId ] = $ displayName ;
60- $ this ->memCache ->set ($ userId , $ displayName , 60 * 10 ); // 10 minutes
62+ $ this ->memCache ->set ($ userId , $ displayName , self :: CACHE_TTL );
6163
6264 return $ displayName ;
6365 }
@@ -72,7 +74,7 @@ public function handle(Event $event): void {
7274 $ userId = $ event ->getUser ()->getUID ();
7375 $ newDisplayName = $ event ->getValue ();
7476 $ this ->cache [$ userId ] = $ newDisplayName ;
75- $ this ->memCache ->set ($ userId , $ newDisplayName , 60 * 10 ); // 10 minutes
77+ $ this ->memCache ->set ($ userId , $ newDisplayName , self :: CACHE_TTL );
7678 }
7779 if ($ event instanceof UserDeletedEvent) {
7880 $ userId = $ event ->getUser ()->getUID ();
You can’t perform that action at this time.
0 commit comments