mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Difficulty cache invalidation 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,15 @@ namespace osu.Game.Database
|
||||
return computed;
|
||||
}
|
||||
|
||||
protected void Invalidate(Func<TLookup, bool> invalidationFunction)
|
||||
{
|
||||
foreach (var kvp in cache)
|
||||
{
|
||||
if (invalidationFunction(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