Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2
Create static TopicIndex cache #116
Copy link
Copy link
Closed
Labels
Area: RepositoriesRelates to the `ITopicRepository` interface or one of its implementations.Relates to the `ITopicRepository` interface or one of its implementations.Priority: 1Severity 2: MajorStatus 5: CompleteTask is considered complete, and ready for deployment.Task is considered complete, and ready for deployment.Type: ImprovementImproves the functionality or interface of an existing feature.Improves the functionality or interface of an existing feature.
Milestone
Description
Metadata
Metadata
Assignees
Labels
Area: RepositoriesRelates to the `ITopicRepository` interface or one of its implementations.Relates to the `ITopicRepository` interface or one of its implementations.Priority: 1Severity 2: MajorStatus 5: CompleteTask is considered complete, and ready for deployment.Task is considered complete, and ready for deployment.Type: ImprovementImproves the functionality or interface of an existing feature.Improves the functionality or interface of an existing feature.
Whenever
referenceTopicis passed to mostITopicRepository.Load()implementation, it ultimately needs to be indexed viareferenceTopic.GetRootTopic().GetTopicIndex(). This requires crawling the entire tree each request. Meanwhile, consumers like theCachedTopicServiceend up maintaining their own cache. Instead, provide a static reference to a list ofTopicIndexinstances keyed by their root topic instance.While this isn't strictly necessary for lazy-loading (#111), it provides an important performance foundation for lazy-loading capabilities, such as dynamically resolving associations and merging ascendants into an existing tree.
Garbage Handling
This will need to use a
ConditionalWeakTable<>(CWT) to make sure that this doesn't hold onto e.g., one-time indexes no longer referenced by other code. Otherwise, this could result in a memory leak with every one-off load potentially being held onto indefinitely.Tasks
TopicIndexRegistry: Concurrency-safe storage, with hooks for attaching, detaching, and assigning IDs, assigned onParentCachedTopicRepositoryonto the live index, retiring its redundant_topicIdIndex