Skip to content

Commit ca08e60

Browse files
committed
revert-image cache as dictionary, concurrent not serializable
1 parent ffa68a5 commit ca08e60

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Flow.Launcher.Infrastructure/Image/ImageLoader.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Flow.Launcher.Infrastructure.Image
1414
public static class ImageLoader
1515
{
1616
private static readonly ImageCache ImageCache = new ImageCache();
17-
private static BinaryStorage<ConcurrentDictionary<string, int>> _storage;
17+
private static BinaryStorage<Dictionary<string, int>> _storage;
1818
private static readonly ConcurrentDictionary<string, string> GuidToKey = new ConcurrentDictionary<string, string>();
1919
private static IImageHashGenerator _hashGenerator;
2020
private static bool EnableImageHash = true;
@@ -32,7 +32,7 @@ public static class ImageLoader
3232

3333
public static void Initialize()
3434
{
35-
_storage = new BinaryStorage<ConcurrentDictionary<string, int>>("Image");
35+
_storage = new BinaryStorage<Dictionary<string, int>>("Image");
3636
_hashGenerator = new ImageHashGenerator();
3737

3838
ImageCache.Usage = LoadStorageToConcurrentDictionary();
@@ -62,15 +62,15 @@ public static void Save()
6262
lock (_storage)
6363
{
6464
ImageCache.Cleanup();
65-
_storage.Save(ImageCache.Usage);
65+
_storage.Save(new Dictionary<string, int>(ImageCache.Usage));
6666
}
6767
}
6868

6969
private static ConcurrentDictionary<string, int> LoadStorageToConcurrentDictionary()
7070
{
7171
lock(_storage)
7272
{
73-
var loaded = _storage.TryLoad(new ConcurrentDictionary<string, int>());
73+
var loaded = _storage.TryLoad(new Dictionary<string, int>());
7474

7575
return new ConcurrentDictionary<string, int>(loaded);
7676
}

0 commit comments

Comments
 (0)