V15: Refresh caches on load balanced environments (#17296)
* Move DocumentCacheService * Add clear all documentws from memory cache * Fix RedirectTracker * Implement refresh node/branch/all/delete * Only update databasecache in RefreshContentAsync * Fix tests * Skip blueprints in cache * Clear caches when contenttype is updated * Clear cache on data type update * Refresh media * Only update memory cache from refreshers * Fix imports * Add named options * Use cache entry settings in media * Obsolete nucache settings --------- Co-authored-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
@@ -120,11 +120,21 @@ public class PublishedContentTypeCache : IPublishedContentTypeCache
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearContentTypes(IEnumerable<int> ids)
|
||||
{
|
||||
foreach (var id in ids)
|
||||
{
|
||||
ClearContentType(id);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears all cached content types referencing a data type.
|
||||
/// </summary>
|
||||
/// <param name="id">A data type identifier.</param>
|
||||
public void ClearDataType(int id)
|
||||
public void ClearDataType(int id) => ClearByDataTypeId(id);
|
||||
|
||||
public IEnumerable<IPublishedContentType> ClearByDataTypeId(int id)
|
||||
{
|
||||
if (_logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug))
|
||||
{
|
||||
@@ -135,11 +145,12 @@ public class PublishedContentTypeCache : IPublishedContentTypeCache
|
||||
// properties ie both its own properties and those that were inherited (it's based upon an
|
||||
// IContentTypeComposition) and so every PublishedContentType having a property based upon
|
||||
// the cleared data type, be it local or inherited, will be cleared.
|
||||
IPublishedContentType[] toRemove;
|
||||
try
|
||||
{
|
||||
_lock.EnterWriteLock();
|
||||
|
||||
IPublishedContentType[] toRemove = _typesById.Values
|
||||
toRemove = _typesById.Values
|
||||
.Where(x => x.PropertyTypes.Any(xx => xx.DataType.Id == id)).ToArray();
|
||||
foreach (IPublishedContentType type in toRemove)
|
||||
{
|
||||
@@ -154,6 +165,8 @@ public class PublishedContentTypeCache : IPublishedContentTypeCache
|
||||
_lock.ExitWriteLock();
|
||||
}
|
||||
}
|
||||
|
||||
return toRemove;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user