Merge pull request #18835 from peppy/beatmap-update-flow

Split out beatmap update tasks to `BeatmapUpdater` and invoke from editor save flow
This commit is contained in:
Dan Balasescu
2022-07-01 20:28:04 +09:00
committed by GitHub
13 changed files with 277 additions and 126 deletions

View File

@ -3,6 +3,7 @@
#nullable disable
using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
@ -39,6 +40,19 @@ namespace osu.Game.Database
return computed;
}
/// <summary>
/// Invalidate all entries matching a provided predicate.
/// </summary>
/// <param name="matchKeyPredicate">The predicate to decide which keys should be invalidated.</param>
protected void Invalidate(Func<TLookup, bool> matchKeyPredicate)
{
foreach (var kvp in cache)
{
if (matchKeyPredicate(kvp.Key))
cache.TryRemove(kvp.Key, out _);
}
}
protected bool CheckExists([NotNull] TLookup lookup, out TValue value) =>
cache.TryGetValue(lookup, out value);