V15: Fix reload memory cache endpoint (#17446)
* Check for id later. * Return 501 status codes from obsoleted endpoints * Use contants * Ensure ordering of cache refresher is not changes --------- Co-authored-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
@@ -86,15 +86,16 @@ public sealed class ContentCacheRefresher : PayloadCacheRefresherBase<ContentCac
|
||||
var idsRemoved = new HashSet<int>();
|
||||
IAppPolicyCache isolatedCache = AppCaches.IsolatedCaches.GetOrCreate<IContent>();
|
||||
|
||||
foreach (JsonPayload payload in payloads.Where(x => x.Id != default))
|
||||
foreach (JsonPayload payload in payloads)
|
||||
{
|
||||
// By INT Id
|
||||
isolatedCache.Clear(RepositoryCacheKeys.GetKey<IContent, int>(payload.Id));
|
||||
|
||||
// By GUID Key
|
||||
isolatedCache.Clear(RepositoryCacheKeys.GetKey<IContent, Guid?>(payload.Key));
|
||||
|
||||
if (payload.Id != default)
|
||||
{
|
||||
// By INT Id
|
||||
isolatedCache.Clear(RepositoryCacheKeys.GetKey<IContent, int>(payload.Id));
|
||||
|
||||
// By GUID Key
|
||||
isolatedCache.Clear(RepositoryCacheKeys.GetKey<IContent, Guid?>(payload.Key));
|
||||
}
|
||||
|
||||
// remove those that are in the branch
|
||||
if (payload.ChangeTypes.HasTypesAny(TreeChangeTypes.RefreshBranch | TreeChangeTypes.Remove))
|
||||
@@ -115,7 +116,10 @@ public sealed class ContentCacheRefresher : PayloadCacheRefresherBase<ContentCac
|
||||
|
||||
HandleNavigation(payload);
|
||||
HandlePublishedAsync(payload, CancellationToken.None).GetAwaiter().GetResult();
|
||||
_idKeyMap.ClearCache(payload.Id);
|
||||
if (payload.Id != default)
|
||||
{
|
||||
_idKeyMap.ClearCache(payload.Id);
|
||||
}
|
||||
if (payload.Key.HasValue)
|
||||
{
|
||||
_idKeyMap.ClearCache(payload.Key.Value);
|
||||
|
||||
Reference in New Issue
Block a user