diff --git a/packages/backend/src/core/CacheService.ts b/packages/backend/src/core/CacheService.ts index 6f9fb6eeea..30c313cbf1 100644 --- a/packages/backend/src/core/CacheService.ts +++ b/packages/backend/src/core/CacheService.ts @@ -33,15 +33,56 @@ export interface FollowStats { @Injectable() export class CacheService implements OnApplicationShutdown { + /** + * Maps user IDs (key) to MiUser instances (value). + * This is the ONLY source for cached MiUser entities! + */ public readonly userByIdCache: ManagedQuantumKVCache; - public readonly nativeTokenCache: ManagedQuantumKVCache; // Token -> UserId - public readonly userByAcctCache: ManagedQuantumKVCache; // Acct -> UserId + + /** + * Maps native tokens (key) to user IDs (value). + */ + public readonly nativeTokenCache: ManagedQuantumKVCache; + + /** + * Maps acct handles (key) to user IDs (value). + */ + public readonly userByAcctCache: ManagedQuantumKVCache; + + /** + * Maps user IDs (key) to MiUserProfile instances (value). + * This is the ONLY source for cached MiUserProfile entities! + */ public readonly userProfileCache: ManagedQuantumKVCache; + + /** + * Maps user IDs (key) to the set of user IDs (value) muted by that user. + */ public readonly userMutingsCache: ManagedQuantumKVCache>; + + /** + * Maps user IDs (key) to the set of user IDs (value) muting that user. + */ public readonly userMutedCache: ManagedQuantumKVCache>; + + /** + * Maps user IDs (key) to the set of user IDs (value) blocked by that user. + */ public readonly userBlockingCache: ManagedQuantumKVCache>; - public readonly userBlockedCache: ManagedQuantumKVCache>; // NOTE: 「被」Blockキャッシュ + + /** + * Maps user IDs (key) to the set of user IDs (value) blocking that user. + */ + public readonly userBlockedCache: ManagedQuantumKVCache>; + + /** + * Maps user IDs (key) to the map of list ID / MiUserListMembership instances (value) for all lists containing this user. + */ public readonly userListMembershipsCache: ManagedQuantumKVCache>; + + /** + * Maps list IDs (key) to the map of user ID / MiUserListMembership instances (value) for all users in this list. + */ public readonly listUserMembershipsCache: ManagedQuantumKVCache>; /** @@ -58,12 +99,40 @@ export class CacheService implements OnApplicationShutdown { * Maps user IDs (key) to the set of user IDs (value) who's renotes are muted by that user. */ public readonly renoteMutingsCache: ManagedQuantumKVCache>; + + /** + * Maps user IDs (key) to the set of thread IDs (value) muted by that user. + */ public readonly threadMutingsCache: ManagedQuantumKVCache>; + + /** + * Maps user IDs (key) to the set of note IDs (value) muted by that user. + */ public readonly noteMutingsCache: ManagedQuantumKVCache>; + + /** + * Maps user IDs (key) to the map of user ID / MiFollowing instances (value) followed by that user. + */ public readonly userFollowingsCache: ManagedQuantumKVCache>>; + + /** + * Maps user IDs (key) to the map of user ID / MiFollowing instances (value) following that user. + */ public readonly userFollowersCache: ManagedQuantumKVCache>>; + + /** + * Maps user IDs (key) to hibernation state (value). + */ public readonly hibernatedUserCache: ManagedQuantumKVCache; + + /** + * Maps user IDs (key) to follow statistics (value). + */ public readonly userFollowStatsCache: ManagedMemoryKVCache; + + /** + * Maps user IDs (key) to the set of cahnnel IDs (value) followed by that user. + */ public readonly userFollowingChannelsCache: ManagedQuantumKVCache>; constructor(