mirror of
https://github.com/nextcloud/server.git
synced 2026-04-23 15:21:00 -04:00
Also cache non-existing to reuse it
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
72f7ccf0b2
commit
ee0ed229e3
1 changed files with 5 additions and 0 deletions
|
|
@ -97,12 +97,17 @@ class PublicKeyTokenProvider implements IProvider {
|
|||
$tokenHash = $this->hashToken($tokenId);
|
||||
|
||||
if (isset($this->cache[$tokenHash])) {
|
||||
if ($this->cache[$tokenHash] instanceof DoesNotExistException) {
|
||||
$ex = $this->cache[$tokenHash];
|
||||
throw new InvalidTokenException("Token does not exist: " . $ex->getMessage(), 0, $ex);
|
||||
}
|
||||
$token = $this->cache[$tokenHash];
|
||||
} else {
|
||||
try {
|
||||
$token = $this->mapper->getToken($this->hashToken($tokenId));
|
||||
$this->cache[$token->getToken()] = $token;
|
||||
} catch (DoesNotExistException $ex) {
|
||||
$this->cache[$tokenHash] = $ex;
|
||||
throw new InvalidTokenException("Token does not exist: " . $ex->getMessage(), 0, $ex);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue