From 513bfd0816fdd2a92ea43d49028fb5fd1af7d15a 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 bba64a06eff2..e4268a20a221 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