Fix Nucache rebuilding more type caches than necessary (#12785)
This commit is contained in:
@@ -97,6 +97,7 @@ public class NuCacheContentRepository : RepositoryBase, INuCacheContentRepositor
|
||||
OnRepositoryRefreshed(serializer, member, false);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Rebuild(
|
||||
IReadOnlyCollection<int>? contentTypeIds = null,
|
||||
IReadOnlyCollection<int>? mediaTypeIds = null,
|
||||
@@ -107,9 +108,20 @@ public class NuCacheContentRepository : RepositoryBase, INuCacheContentRepositor
|
||||
| ContentCacheDataSerializerEntityType.Media
|
||||
| ContentCacheDataSerializerEntityType.Member);
|
||||
|
||||
RebuildContentDbCache(serializer, _nucacheSettings.Value.SqlPageSize, contentTypeIds);
|
||||
RebuildMediaDbCache(serializer, _nucacheSettings.Value.SqlPageSize, mediaTypeIds);
|
||||
RebuildMemberDbCache(serializer, _nucacheSettings.Value.SqlPageSize, memberTypeIds);
|
||||
if(contentTypeIds != null)
|
||||
{
|
||||
RebuildContentDbCache(serializer, _nucacheSettings.Value.SqlPageSize, contentTypeIds);
|
||||
}
|
||||
|
||||
if (mediaTypeIds != null)
|
||||
{
|
||||
RebuildMediaDbCache(serializer, _nucacheSettings.Value.SqlPageSize, mediaTypeIds);
|
||||
}
|
||||
|
||||
if (memberTypeIds != null)
|
||||
{
|
||||
RebuildMemberDbCache(serializer, _nucacheSettings.Value.SqlPageSize, memberTypeIds);
|
||||
}
|
||||
}
|
||||
|
||||
// assumes content tree lock
|
||||
|
||||
@@ -51,7 +51,7 @@ public class NuCacheContentService : RepositoryService, INuCacheContentService
|
||||
using (_profilingLogger.TraceDuration<NuCacheContentService>(
|
||||
$"Rebuilding NuCache database with {serializer} serializer"))
|
||||
{
|
||||
Rebuild();
|
||||
RebuildAll();
|
||||
_keyValueService.SetValue(NuCacheSerializerKey, serializer.ToString());
|
||||
}
|
||||
}
|
||||
@@ -113,11 +113,17 @@ public class NuCacheContentService : RepositoryService, INuCacheContentService
|
||||
public void RefreshMember(IMember member)
|
||||
=> _repository.RefreshMember(member);
|
||||
|
||||
/// <inheritdoc />
|
||||
public void RebuildAll()
|
||||
{
|
||||
Rebuild(Array.Empty<int>(), Array.Empty<int>(), Array.Empty<int>());
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Rebuild(
|
||||
IReadOnlyCollection<int>? contentTypeIds = null,
|
||||
IReadOnlyCollection<int>? mediaTypeIds = null,
|
||||
IReadOnlyCollection<int>? memberTypeIds = null)
|
||||
IReadOnlyCollection<int>? contentTypeIds = null,
|
||||
IReadOnlyCollection<int>? mediaTypeIds = null,
|
||||
IReadOnlyCollection<int>? memberTypeIds = null)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(repositoryCacheMode: RepositoryCacheMode.Scoped))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user