aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSimon L <szaimen@e.mail.de>2023-06-12 13:53:37 +0200
committerGitHub <noreply@github.com>2023-06-12 13:53:37 +0200
commit83faba5e613b4ac8d7fce091e5b545a7a30b1640 (patch)
treecffed03ba4861a5754dae3ff61bdbf6ef1d5104e /lib
parente390a3569e97dabb373b3e9729d853a88ac2f723 (diff)
parentb8c61b3515ef406c4feafc851f12262e417ba157 (diff)
downloadnextcloud-server-83faba5e613b4ac8d7fce091e5b545a7a30b1640.tar.gz
nextcloud-server-83faba5e613b4ac8d7fce091e5b545a7a30b1640.zip
Merge pull request #38591 from nextcloud/fix/caching/avoid-haskey-get
fix(caching): Avoid checking existence before fetching
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Accounts/AccountManager.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php
index 60065272a58..e3068a7ff25 100644
--- a/lib/private/Accounts/AccountManager.php
+++ b/lib/private/Accounts/AccountManager.php
@@ -795,8 +795,9 @@ class AccountManager implements IAccountManager {
}
public function getAccount(IUser $user): IAccount {
- if ($this->internalCache->hasKey($user->getUID())) {
- return $this->internalCache->get($user->getUID());
+ $cached = $this->internalCache->get($user->getUID());
+ if ($cached !== null) {
+ return $cached;
}
$account = $this->parseAccountData($user, $this->getUser($user));
$this->internalCache->set($user->getUID(), $account);