Skip to content

Commit

Permalink
Fix recursive cache
Browse files Browse the repository at this point in the history
  • Loading branch information
KOBA789 committed Oct 6, 2023
1 parent 271a26f commit 9b9d546
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/backend/src/misc/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ 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);
this.memoryCache.set(parsed);
return parsed;
}

@bindThis
Expand All @@ -166,7 +168,6 @@ export class RedisSingleCache<T> {
const cachedValue = await this.get();
if (cachedValue !== undefined) {
// Cache HIT
this.memoryCache.set(cachedValue);
return cachedValue;
}

Expand Down

0 comments on commit 9b9d546

Please sign in to comment.