From 9b9d546ed479021c655cc98f3455f4ace246501e Mon Sep 17 00:00:00 2001 From: Hidekazu Kobayashi Date: Fri, 6 Oct 2023 22:15:38 +0900 Subject: [PATCH] Fix recursive cache --- packages/backend/src/misc/cache.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/misc/cache.ts b/packages/backend/src/misc/cache.ts index b0d6fe049ed5..2c8b5cb4c1b5 100644 --- a/packages/backend/src/misc/cache.ts +++ b/packages/backend/src/misc/cache.ts @@ -149,7 +149,9 @@ 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); + this.memoryCache.set(parsed); + return parsed; } @bindThis @@ -166,7 +168,6 @@ export class RedisSingleCache { const cachedValue = await this.get(); if (cachedValue !== undefined) { // Cache HIT - this.memoryCache.set(cachedValue); return cachedValue; }