Type result
This commit is contained in:
parent
564b9b5597
commit
90dbc73132
1 changed files with 3 additions and 7 deletions
|
@ -411,13 +411,9 @@ class Redis {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async setValue (key: string, value: string, expirationMilliseconds?: number) {
|
private async setValue (key: string, value: string, expirationMilliseconds?: number) {
|
||||||
let result
|
const result = expirationMilliseconds !== undefined
|
||||||
|
? await this.client.set(this.prefix + key, value, 'PX', expirationMilliseconds)
|
||||||
if (expirationMilliseconds !== undefined) {
|
: await this.client.set(this.prefix + key, value)
|
||||||
result = await this.client.set(this.prefix + key, value, 'PX', expirationMilliseconds)
|
|
||||||
} else {
|
|
||||||
result = await this.client.set(this.prefix + key, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result !== 'OK') throw new Error('Redis set result is not OK.')
|
if (result !== 'OK') throw new Error('Redis set result is not OK.')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue