fix(auth): cache only valid results for one day
This commit is contained in:
parent
04469c5b86
commit
a8a02478ce
@ -19,7 +19,7 @@ export class Authentication implements IAuthentication {
|
|||||||
|
|
||||||
const authResult = await this.authenticator.authenticate(username, password);
|
const authResult = await this.authenticator.authenticate(username, password);
|
||||||
console.log(`Auth Result for user ${username}`, authResult ? 'SUCCESS' : 'Failure');
|
console.log(`Auth Result for user ${username}`, authResult ? 'SUCCESS' : 'Failure');
|
||||||
this.cache.set(cacheKey, authResult, 86400); // cache for one day
|
this.cache.set(cacheKey, authResult, authResult ? 86400 : 60); // cache for one day on success, otherwise just for 60 seconds
|
||||||
|
|
||||||
return authResult;
|
return authResult;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user