mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-19 15:55:21 +01:00
b9cb6d1c10
将来ESMに移行しやすいように Related: #7658 なんかmochaが起動しなくなってるけど理由不明 すぐ直したい
10 lines
411 B
TypeScript
10 lines
411 B
TypeScript
import { UserKeypairs } from '@/models/index.js';
|
|
import { User } from '@/models/entities/user.js';
|
|
import { UserKeypair } from '@/models/entities/user-keypair.js';
|
|
import { Cache } from './cache.js';
|
|
|
|
const cache = new Cache<UserKeypair>(Infinity);
|
|
|
|
export async function getUserKeypair(userId: User['id']): Promise<UserKeypair> {
|
|
return await cache.fetch(userId, () => UserKeypairs.findOneOrFail(userId));
|
|
}
|