Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tamaina committed Aug 18, 2024
1 parent d01cd15 commit e4b4e91
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export class ApDbResolverService implements OnApplicationShutdown {
* keyIdで見つからない場合、まずはキャッシュを更新して再取得
* If not found with keyId, update cache and reacquire
*/
const cacheRaw = this.publicKeyByUserIdCache.cache.get(user.id);
const cacheRaw = this.publicKeyByUserIdCache.getRaw(user.id);
if (cacheRaw && Date.now() - cacheRaw.date > 1000 * 60 * 5) {
const exactKey = await this.refreshAndFindKey(user.id, keyId);
if (exactKey) return { user, key: exactKey };
Expand Down
10 changes: 5 additions & 5 deletions packages/backend/src/misc/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,6 @@ export class RedisSingleCache<T> {
return value;
}

@bindThis
public getRaw(): T | undefined {
return this.memoryCache.get();
}

@bindThis
public async delete(): Promise<void> {
this.memoryCache.delete();
Expand Down Expand Up @@ -242,6 +237,11 @@ export class MemoryKVCache<T> {
return cached.value;
}

@bindThis
public getRaw(key: string): { date: number; value: T; } | undefined {
return this.cache.get(key);
}

@bindThis
public delete(key: string): void {
this.cache.delete(key);
Expand Down

0 comments on commit e4b4e91

Please sign in to comment.