From ca08e603087601493526a0c716e7c57f0064b134 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Mon, 10 Aug 2020 07:17:22 +1000 Subject: [PATCH] revert-image cache as dictionary, concurrent not serializable --- Flow.Launcher.Infrastructure/Image/ImageLoader.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs index caff69fcf..29e13a2de 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs @@ -14,7 +14,7 @@ namespace Flow.Launcher.Infrastructure.Image public static class ImageLoader { private static readonly ImageCache ImageCache = new ImageCache(); - private static BinaryStorage> _storage; + private static BinaryStorage> _storage; private static readonly ConcurrentDictionary GuidToKey = new ConcurrentDictionary(); private static IImageHashGenerator _hashGenerator; private static bool EnableImageHash = true; @@ -32,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(); @@ -62,7 +62,7 @@ namespace Flow.Launcher.Infrastructure.Image lock (_storage) { ImageCache.Cleanup(); - _storage.Save(ImageCache.Usage); + _storage.Save(new Dictionary(ImageCache.Usage)); } } @@ -70,7 +70,7 @@ namespace Flow.Launcher.Infrastructure.Image { lock(_storage) { - var loaded = _storage.TryLoad(new ConcurrentDictionary()); + var loaded = _storage.TryLoad(new Dictionary()); return new ConcurrentDictionary(loaded); }