From 533bae1e6c43a9454e1e7f199c847290e4a31021 Mon Sep 17 00:00:00 2001 From: KOBA789 Date: Fri, 6 Oct 2023 22:41:59 +0900 Subject: [PATCH] Hot-fix: Write-back value in memory when it's available in redis (MisskeyIO#174) * Write-back value in memory when it's available in redis * Fix recursive cache * Fix bug in case that invalid data in redis cache --- packages/backend/src/misc/cache.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/misc/cache.ts b/packages/backend/src/misc/cache.ts index 046d4d6c2f..5b841fbaa1 100644 --- a/packages/backend/src/misc/cache.ts +++ b/packages/backend/src/misc/cache.ts @@ -149,7 +149,10 @@ export class RedisSingleCache { const cached = await this.redisClient.get(`singlecache:${this.name}`); if (cached == null) return undefined; - return this.fromRedisConverter(cached); + const parsed = this.fromRedisConverter(cached); + if (parsed == null) return undefined; + this.memoryCache.set(parsed); + return parsed; } @bindThis