RedisKVCache で Redis から読み取った値を MemoryKVCache に書き戻す (MisskeyIO#289)

This commit is contained in:
riku6460 2023-12-26 13:47:32 +09:00 committed by GitHub
parent 086bcab57b
commit 25829e12a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -55,7 +55,10 @@ export class RedisKVCache<T> {
const cached = await this.redisClient.get(`kvcache:${this.name}:${key}`); const cached = await this.redisClient.get(`kvcache:${this.name}:${key}`);
if (cached == null) return undefined; 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 @bindThis