Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Hot-fix: Write-back value in memory when it's available in redis (Mis…
Browse files Browse the repository at this point in the history
…skeyIO#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
  • Loading branch information
KOBA789 authored and nafu-at committed Jul 17, 2024
1 parent 0ba0408 commit 513bfd0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/backend/src/misc/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 513bfd0

Please sign in to comment.