diff --git a/Registry.Ports/ICacheManager.cs b/Registry.Ports/ICacheManager.cs index bc4df4c0..9054cf00 100644 --- a/Registry.Ports/ICacheManager.cs +++ b/Registry.Ports/ICacheManager.cs @@ -13,7 +13,7 @@ public interface ICacheManager void Set(string seed, string category, string data, params object[] parameters); - Task Clear(string seed, string category = null); + void Clear(string seed, string category = null); void Remove(string seed, string category, params object[] parameters); bool IsRegistered(string seed); diff --git a/Registry.Web/Registry.Web.csproj b/Registry.Web/Registry.Web.csproj index e68c6cba..7886a631 100644 --- a/Registry.Web/Registry.Web.csproj +++ b/Registry.Web/Registry.Web.csproj @@ -6,11 +6,11 @@ 4e006835-31cb-47c5-9dfe-7b73e210db92 ClientApp\ $(DefaultItemExcludes);$(SpaRoot)node_modules\** - 1.1.9 - 1.1.9 + 1.1.10 + 1.1.10 1.1.7 AnyCPU;x64 - 1.1.9 + 1.1.10 Debug;Release;DebugEf 1.0.12 diff --git a/Registry.Web/Services/Managers/CacheManager.cs b/Registry.Web/Services/Managers/CacheManager.cs index 32c3ad0a..a0b80378 100644 --- a/Registry.Web/Services/Managers/CacheManager.cs +++ b/Registry.Web/Services/Managers/CacheManager.cs @@ -129,15 +129,16 @@ public void Set(string seed, string category, string data, params object[] param _cache.Set(key, data, policy); } - public Task Clear(string seed, string category = null) + public void Clear(string seed, string category = null) { - return Task.Run(() => - { - var k = category != null ? MakeKey(seed, category, null) : seed; - var keys = _cache.Where(o => o.Key.StartsWith(k)).Select(o => o.Key).ToArray(); - - foreach (var key in keys) - _cache.Remove(key); - }); + ArgumentNullException.ThrowIfNull(seed); + var k = category != null ? MakeKey(seed, category, null) : seed; + + var keys = _cache.Where(o => o.Key != null && o.Key.StartsWith(k)) + .Select(o => o.Key).ToArray(); + + foreach (var key in keys) + _cache.Remove(key); + } } \ No newline at end of file diff --git a/Registry.Web/Services/Managers/ObjectsManager.cs b/Registry.Web/Services/Managers/ObjectsManager.cs index 54a897eb..35564b62 100644 --- a/Registry.Web/Services/Managers/ObjectsManager.cs +++ b/Registry.Web/Services/Managers/ObjectsManager.cs @@ -370,8 +370,8 @@ public async Task Delete(string orgSlug, string dsSlug, string path) _fs.Delete(objLocalPath); - await _cacheManager.Clear(MagicStrings.ThumbnailCacheSeed, obj.Hash); - await _cacheManager.Clear(MagicStrings.TileCacheSeed, obj.Hash); + _cacheManager.Clear(MagicStrings.ThumbnailCacheSeed, obj.Hash); + _cacheManager.Clear(MagicStrings.TileCacheSeed, obj.Hash); } catch (Exception ex) {