From 86f6f9921e58c1d29f5d6f9d960990c6dd564778 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Wed, 5 Aug 2020 19:57:53 +1000 Subject: [PATCH] update to use concurrent dictionary --- Flow.Launcher.Infrastructure/Image/ImageLoader.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs index 10f827c40..573857c43 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs @@ -14,9 +14,8 @@ namespace Flow.Launcher.Infrastructure.Image public static class ImageLoader { private static readonly ImageCache ImageCache = new ImageCache(); - private static readonly ConcurrentDictionary _guidToKey = new ConcurrentDictionary(); + private static BinaryStorage> _storage; private static readonly ConcurrentDictionary GuidToKey = new ConcurrentDictionary(); - private static BinaryStorage> _storage; private static IImageHashGenerator _hashGenerator; private static bool EnableImageHash = true; @@ -33,7 +32,7 @@ namespace Flow.Launcher.Infrastructure.Image public static void Initialize() { - _storage = new BinaryStorage>("Image"); + _storage = new BinaryStorage>("Image"); _hashGenerator = new ImageHashGenerator(); ImageCache.Usage = LoadStorageToConcurrentDictionary(); @@ -70,7 +69,7 @@ namespace Flow.Launcher.Infrastructure.Image { lock(_storage) { - var loaded = _storage.TryLoad(new Dictionary()); + var loaded = _storage.TryLoad(new ConcurrentDictionary()); return new ConcurrentDictionary(loaded); }