Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/Umbraco.Core/Models/CacheSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,39 @@ public class CacheSettings
{
internal const int StaticDocumentBreadthFirstSeedCount = 100;
internal const int StaticMediaBreadthFirstSeedCount = 100;
internal const int StaticDocumentSeedBatchSize = 100;
internal const int StaticMediaSeedBatchSize = 100;

/// <summary>
/// Gets or sets a value for the collection of content type ids to always have in the cache.
/// Gets or sets a value for the collection of content type ids to always have in the cache.
/// </summary>
public List<Guid> ContentTypeKeys { get; set; } =
new();

/// <summary>
/// Gets or sets a value for the document breadth first seed count.
/// </summary>
[DefaultValue(StaticDocumentBreadthFirstSeedCount)]
public int DocumentBreadthFirstSeedCount { get; set; } = StaticDocumentBreadthFirstSeedCount;

/// <summary>
/// Gets or sets a value for the media breadth first seed count.
/// </summary>
[DefaultValue(StaticMediaBreadthFirstSeedCount)]
public int MediaBreadthFirstSeedCount { get; set; } = StaticDocumentBreadthFirstSeedCount;

/// <summary>
/// Gets or sets a value for the document seed batch size.
/// </summary>
[DefaultValue(StaticDocumentSeedBatchSize)]
public int DocumentSeedBatchSize { get; set; } = StaticDocumentSeedBatchSize;

/// <summary>
/// Gets or sets a value for the media seed batch size.
/// </summary>
[DefaultValue(StaticMediaSeedBatchSize)]
public int MediaSeedBatchSize { get; set; } = StaticMediaSeedBatchSize;

public CacheEntry Entry { get; set; } = new CacheEntry();

public class CacheEntry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ public async Task SeedAsync(CancellationToken cancellationToken)
sw.Start();
#endif

const int GroupSize = 100;
foreach (IEnumerable<Guid> group in SeedKeys.InGroupsOf(GroupSize))
foreach (IEnumerable<Guid> group in SeedKeys.InGroupsOf(_cacheSettings.DocumentSeedBatchSize))
{
var uncachedKeys = new HashSet<Guid>();
foreach (Guid key in group)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ public async Task SeedAsync(CancellationToken cancellationToken)
sw.Start();
#endif

const int GroupSize = 100;
foreach (IEnumerable<Guid> group in SeedKeys.InGroupsOf(GroupSize))
foreach (IEnumerable<Guid> group in SeedKeys.InGroupsOf(_cacheSettings.MediaSeedBatchSize))
{
var uncachedKeys = new HashSet<Guid>();
foreach (Guid key in group)
Expand Down