mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
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:
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user