using System.Collections.Concurrent; namespace Jellyfin.Plugin.YandexMusic.Providers; /// /// Artists resolved from Yandex for an audio file. Applied after the merge so stale or /// combined artist names from tags do not accumulate between refreshes. /// public static class ArtistCache { private static readonly ConcurrentDictionary Cache = new(StringComparer.Ordinal); /// Stores artists for an audio file path. public static void Set(string? path, string[] artists) { if (string.IsNullOrWhiteSpace(path) || artists.Length == 0) { return; } Cache[path] = artists; } /// Gets artists for an audio file path. public static bool TryGet(string? path, out string[] artists) { if (!string.IsNullOrWhiteSpace(path) && Cache.TryGetValue(path, out var value)) { artists = value; return true; } artists = []; return false; } }