Skip to content

Commit 886bd81

Browse files
committed
boost(icon): improve the logic that cache device icons
1 parent 180ca33 commit 886bd81

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

SoundSwitch.Common/Framework/Audio/Icon/AudioDeviceIconExtractor.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class AudioDeviceIconExtractor
2828

2929
private static readonly IMemoryCache IconCache = new MemoryCache(new MemoryCacheOptions
3030
{
31-
SizeLimit = 3200
31+
SizeLimit = 500
3232
});
3333

3434
private static string GetKey(MMDevice audioDevice, bool largeIcon)
@@ -72,7 +72,7 @@ public static System.Drawing.Icon ExtractIconFromPath(string path, DataFlow data
7272
}
7373
using var entry = IconCache.CreateEntry(key);
7474
entry.SetValue(icon)
75-
.SetSize(icon.Size.Height)
75+
.SetSize(largeIcon? 2 : 1)
7676
.SetSlidingExpiration(TimeSpan.FromMinutes(30))
7777
.SetPriority(largeIcon ? CacheItemPriority.High : CacheItemPriority.Low)
7878
.RegisterPostEvictionCallback((o, value, reason, state) =>

0 commit comments

Comments
 (0)