prevent crash if Redis cache has a negative lifetime

This commit is contained in:
Hazelnoot 2025-09-30 22:14:19 -04:00
parent 20b763c3c3
commit ac0e3d9394

View file

@ -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),