Removed concrete type checks for back-office published cache details, so now working from interface. Renamed controller and FE assets to more generic name.

This commit is contained in:
Andy Butland
2020-02-04 19:18:35 +01:00
parent 28267087ef
commit b0c752bc5c
9 changed files with 56 additions and 75 deletions

View File

@@ -0,0 +1,46 @@
using System;
using System.Web.Http;
using Umbraco.Web.Cache;
using Umbraco.Web.Composing;
using Umbraco.Web.PublishedCache;
using Umbraco.Web.WebApi;
namespace Umbraco.Web.Editors
{
public class PublishedSnapshotCacheStatusController : UmbracoAuthorizedApiController
{
private readonly IPublishedSnapshotService _publishedSnapshotService;
public PublishedSnapshotCacheStatusController(IPublishedSnapshotService publishedSnapshotService)
{
_publishedSnapshotService = publishedSnapshotService ?? throw new ArgumentNullException(nameof(publishedSnapshotService));
}
[HttpPost]
public string RebuildDbCache()
{
_publishedSnapshotService.Rebuild();
return _publishedSnapshotService.GetStatus();
}
[HttpGet]
public string GetStatus()
{
return _publishedSnapshotService.GetStatus();
}
[HttpGet]
public string Collect()
{
GC.Collect();
_publishedSnapshotService.Collect();
return _publishedSnapshotService.GetStatus();
}
[HttpPost]
public void ReloadCache()
{
Current.DistributedCache.RefreshAllPublishedSnapshot();
}
}
}