refactor(backend): rename Cache -> MemoryCache

This commit is contained in:
syuilo 2023-04-04 15:56:47 +09:00
parent a5f76c064e
commit 7f3afac0a2
15 changed files with 54 additions and 54 deletions

View file

@ -4,7 +4,7 @@ import type { NotesRepository, UsersRepository } from '@/models/index.js';
import type { Config } from '@/config.js';
import { MetaService } from '@/core/MetaService.js';
import { MAX_NOTE_TEXT_LENGTH } from '@/const.js';
import { KVCache } from '@/misc/cache.js';
import { MemoryKVCache } from '@/misc/cache.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { bindThis } from '@/decorators.js';
import NotesChart from '@/core/chart/charts/notes.js';
@ -118,7 +118,7 @@ export class NodeinfoServerService {
};
};
const cache = new KVCache<Awaited<ReturnType<typeof nodeinfo2>>>(1000 * 60 * 10);
const cache = new MemoryKVCache<Awaited<ReturnType<typeof nodeinfo2>>>(1000 * 60 * 10);
fastify.get(nodeinfo2_1path, async (request, reply) => {
const base = await cache.fetch(null, () => nodeinfo2());

View file

@ -3,7 +3,7 @@ import { DI } from '@/di-symbols.js';
import type { AccessTokensRepository, AppsRepository, UsersRepository } from '@/models/index.js';
import type { LocalUser } from '@/models/entities/User.js';
import type { AccessToken } from '@/models/entities/AccessToken.js';
import { KVCache } from '@/misc/cache.js';
import { MemoryKVCache } from '@/misc/cache.js';
import type { App } from '@/models/entities/App.js';
import { UserCacheService } from '@/core/UserCacheService.js';
import isNativeToken from '@/misc/is-native-token.js';
@ -18,7 +18,7 @@ export class AuthenticationError extends Error {
@Injectable()
export class AuthenticateService {
private appCache: KVCache<App>;
private appCache: MemoryKVCache<App>;
constructor(
@Inject(DI.usersRepository)
@ -32,7 +32,7 @@ export class AuthenticateService {
private userCacheService: UserCacheService,
) {
this.appCache = new KVCache<App>(Infinity);
this.appCache = new MemoryKVCache<App>(Infinity);
}
@bindThis