Commit dcdbab2
committed
Initialize
When `SqlTopicRepository.Load()` is called, attempt to update the `GetContentTypeDescriptors()` cache by calling the new `SetContentTypeDescriptors()` overload (78a9d3f).
There are two main advantages to this. First, it helps prevent an unnecessary and redundant call to the database in order to initialize the `GetContentTypeDescriptors()` cache. Second, it helps further ensure that the object references used by that cache are the same ones used by any subsequent caching layer since, in practice, the first call to `Load()` will be to warm the site cache by pulling the entire topic graph.
(Unfortunately, because `CachedTopicRepository` uses a decorator pattern, it can't otherwise share the cache very easily with the underlying `ITopicRepository` instance, since that instance isn't guaranteed to inherit from `TopicRepositoryBase`—and since it isn't using actual inheritance. The decorator pattern allows the `CachedTopicRepository` to be used with _any_ implementation, not just the e.g., `SqlTopicRepository`, so this makes sense. But given that, we need to get creative to avoid versioning conflicts between caches. In most cases, this update should mitigate that.)GetContentTypeDescriptors() cache on Load()
1 parent c75bbe2 commit dcdbab2
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
176 | 186 | | |
177 | 187 | | |
178 | 188 | | |
| |||
0 commit comments