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
This commit is contained in:
parent
3717666807
commit
533bae1e6c
|
@ -149,7 +149,10 @@ export class RedisSingleCache<T> {
|
|||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue