Move database cache rebuild to a background task with polling (#18496)

* Use background queue for database cache rebuild and track rebuilding status.

* Updated OpenApi.json and client-side types.

* Updated client to poll for completion of database rebuild.

* Update src/Umbraco.Cms.Api.Management/Controllers/PublishedCache/RebuildPublishedCacheController.cs

Co-authored-by: Sven Geusens <sge@umbraco.dk>

* Removed unnecessary obsolete attribute.

---------

Co-authored-by: Sven Geusens <sge@umbraco.dk>
This commit is contained in:
Andy Butland
2025-03-06 10:23:00 +01:00
committed by GitHub
parent 7b422598f9
commit 6d0dd82781
12 changed files with 239 additions and 21 deletions

View File

@@ -1,8 +1,33 @@
namespace Umbraco.Cms.Core.PublishedCache;
namespace Umbraco.Cms.Core.PublishedCache;
/// <summary>
/// Defines operations for rebuild of the published content cache in the database.
/// </summary>
public interface IDatabaseCacheRebuilder
{
/// <summary>
/// Indicates if the database cache is in the process of being rebuilt.
/// </summary>
/// <returns></returns>
bool IsRebuilding() => false;
/// <summary>
/// Rebuilds the database cache.
/// </summary>
[Obsolete("Use the overload with the useBackgroundThread parameter. Scheduled for removal in Umbraco 17.")]
void Rebuild();
/// <summary>
/// Rebuilds the database cache, optionally using a background thread.
/// </summary>
/// <param name="useBackgroundThread">Flag indicating whether to use a background thread for the operation and immediately return to the caller.</param>
void Rebuild(bool useBackgroundThread)
#pragma warning disable CS0618 // Type or member is obsolete
=> Rebuild();
#pragma warning restore CS0618 // Type or member is obsolete
/// <summary>
/// Rebuids the database cache if the configured serializer has changed.
/// </summary>
void RebuildDatabaseCacheIfSerializerChanged();
}