From a27fa981c2a17df4f604560cd67de8471c71ca0e Mon Sep 17 00:00:00 2001 From: riku6460 <17585784+riku6460@users.noreply.github.com> Date: Tue, 26 Dec 2023 13:33:36 +0900 Subject: [PATCH] =?UTF-8?q?RedisKVCache=20=E3=81=A7=20Redis=20=E3=81=8B?= =?UTF-8?q?=E3=82=89=E8=AA=AD=E3=81=BF=E5=8F=96=E3=81=A3=E3=81=9F=E5=80=A4?= =?UTF-8?q?=E3=82=92=20MemoryKVCache=20=E3=81=AB=E6=9B=B8=E3=81=8D?= =?UTF-8?q?=E6=88=BB=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/MisskeyIO/misskey/pull/174 --- packages/backend/src/misc/cache.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/misc/cache.ts b/packages/backend/src/misc/cache.ts index 742dad08570f..d385a3e75e67 100644 --- a/packages/backend/src/misc/cache.ts +++ b/packages/backend/src/misc/cache.ts @@ -55,7 +55,10 @@ export class RedisKVCache { const cached = await this.redisClient.get(`kvcache:${this.name}:${key}`); if (cached == null) return undefined; - return this.fromRedisConverter(cached); + const parsed = this.fromRedisConverter(cached); + if (parsed == null) return undefined; + this.memoryCache.set(key, parsed); + return parsed; } @bindThis @@ -150,7 +153,7 @@ export class RedisSingleCache { const cached = await this.redisClient.get(`singlecache:${this.name}`); if (cached == null) return undefined; const parsed = this.fromRedisConverter(cached); - if (parsed == null) return undefined; + if (parsed == null) return undefined; this.memoryCache.set(parsed); return parsed; }