Files
Umbraco-CMS/src/Umbraco.Web/Migrations/PostMigrations/PublishedSnapshotRebuilder.cs
2019-02-13 13:30:13 +01:00

32 lines
1.1 KiB
C#

using Umbraco.Core.Migrations.PostMigrations;
using Umbraco.Web.Cache;
using Umbraco.Web.PublishedCache;
namespace Umbraco.Web.Migrations.PostMigrations
{
/// <summary>
/// Implements <see cref="IPublishedSnapshotRebuilder"/> in Umbraco.Web (rebuilding).
/// </summary>
public class PublishedSnapshotRebuilder : IPublishedSnapshotRebuilder
{
private readonly IPublishedSnapshotService _publishedSnapshotService;
private readonly DistributedCache _distributedCache;
/// <summary>
/// Initializes a new instance of the <see cref="PublishedSnapshotRebuilder"/> class.
/// </summary>
public PublishedSnapshotRebuilder(IPublishedSnapshotService publishedSnapshotService, DistributedCache distributedCache)
{
_publishedSnapshotService = publishedSnapshotService;
_distributedCache = distributedCache;
}
/// <inheritdoc />
public void Rebuild()
{
_publishedSnapshotService.Rebuild();
_distributedCache.RefreshAllPublishedSnapshot();
}
}
}