Skip to content

Commit

Permalink
added an in-memory cache for searching for existing beatmapsets inste…
Browse files Browse the repository at this point in the history
…ad of looping every time the extraction directory which is slow.
  • Loading branch information
waylaa committed Dec 7, 2023
1 parent 0a8263e commit c4568bf
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions OsuCollectionDownloader/Cache/FrozenDirectoryCache.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OsuCollectionDownloader.Cache;

internal sealed class FrozenDirectoryCache(string path)
{
internal FrozenSet<string> Items { get; } = new HashSet<string>(Directory.EnumerateDirectories(path), StringComparer.OrdinalIgnoreCase).ToFrozenSet();
}

0 comments on commit c4568bf

Please sign in to comment.