mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Move Image Cache filtering earlier
This commit is contained in:
parent
4dd4cdafbf
commit
b1dd7b4181
1 changed files with 6 additions and 8 deletions
|
|
@ -26,7 +26,7 @@ namespace Flow.Launcher.Infrastructure.Image
|
|||
private const int MaxCached = 50;
|
||||
public ConcurrentDictionary<string, ImageUsage> Data { get; private set; } = new ConcurrentDictionary<string, ImageUsage>();
|
||||
private const int permissibleFactor = 2;
|
||||
|
||||
|
||||
public void Initialization(Dictionary<string, int> usage)
|
||||
{
|
||||
foreach (var key in usage.Keys)
|
||||
|
|
@ -65,15 +65,13 @@ namespace Flow.Launcher.Infrastructure.Image
|
|||
if (Data.Count > permissibleFactor * MaxCached)
|
||||
{
|
||||
// To delete the images from the data dictionary based on the resizing of the Usage Dictionary.
|
||||
|
||||
|
||||
foreach (var key in Data.Where(x => x.Key != Constant.MissingImgIcon)
|
||||
foreach (var key in Data
|
||||
.Where(x => x.Key != Constant.MissingImgIcon
|
||||
&& x.Key != Constant.ErrorIcon
|
||||
&& x.Key != Constant.DefaultIcon)
|
||||
.OrderBy(x => x.Value.usage).Take(Data.Count - MaxCached).Select(x => x.Key))
|
||||
{
|
||||
if (!(key.Equals(Constant.ErrorIcon) || key.Equals(Constant.DefaultIcon)))
|
||||
{
|
||||
Data.TryRemove(key, out _);
|
||||
}
|
||||
Data.TryRemove(key, out _);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue