Make ValueEditorCacheRefresher a distributed cache refresher

This commit is contained in:
Nikolaj
2021-08-30 10:45:47 +02:00
parent 90bc927d66
commit d448ddd7df
4 changed files with 63 additions and 12 deletions

View File

@@ -1,6 +1,7 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.Collections.Generic;
using System.Linq;
using Umbraco.Cms.Core.Cache;
using Umbraco.Cms.Core.Models;
@@ -106,6 +107,21 @@ namespace Umbraco.Extensions
#endregion
#region ValueEditorCache
public static void RefreshValueEditorCache(this DistributedCache dc, IEnumerable<IDataType> dataTypes)
{
if (dataTypes is null)
{
return;
}
var payloads = dataTypes.Select(x => new DataTypeCacheRefresher.JsonPayload(x.Id, x.Key, false));
dc.RefreshByPayload(ValueEditorCacheRefresher.UniqueId, payloads);
}
#endregion
#region ContentCache
public static void RefreshAllContentCache(this DistributedCache dc)