prevent crash if Redis cache has a negative lifetime
This commit is contained in:
parent
20b763c3c3
commit
ac0e3d9394
1 changed files with 2 additions and 2 deletions
|
|
@ -39,7 +39,7 @@ export class RedisKVCache<T> {
|
|||
`kvcache:${this.name}:${key}`,
|
||||
this.toRedisConverter(value),
|
||||
);
|
||||
} else {
|
||||
} else if (this.lifetime > 0) {
|
||||
await this.redisClient.set(
|
||||
`kvcache:${this.name}:${key}`,
|
||||
this.toRedisConverter(value),
|
||||
|
|
@ -149,7 +149,7 @@ export class RedisSingleCache<T> {
|
|||
`singlecache:${this.name}`,
|
||||
this.toRedisConverter(value),
|
||||
);
|
||||
} else {
|
||||
} else if (this.lifetime > 0) {
|
||||
await this.redisClient.set(
|
||||
`singlecache:${this.name}`,
|
||||
this.toRedisConverter(value),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue