1
0
Fork 0

Type result

This commit is contained in:
Chocobozzz 2022-11-14 16:36:17 +01:00
parent 564b9b5597
commit 90dbc73132
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 3 additions and 7 deletions

View File

@ -411,13 +411,9 @@ class Redis {
}
private async setValue (key: string, value: string, expirationMilliseconds?: number) {
let result
if (expirationMilliseconds !== undefined) {
result = await this.client.set(this.prefix + key, value, 'PX', expirationMilliseconds)
} else {
result = await this.client.set(this.prefix + key, value)
}
const result = expirationMilliseconds !== undefined
? await this.client.set(this.prefix + key, value, 'PX', expirationMilliseconds)
: await this.client.set(this.prefix + key, value)
if (result !== 'OK') throw new Error('Redis set result is not OK.')
}