LANCommander/LANCommander.Server.Services/Extensions/CacheExtensions.cs

18 lines
561 B
C#
Raw Normal View History

using ZiggyCreatures.Caching.Fusion;
namespace LANCommander.Server.Services.Extensions;
public static class CacheExtensions
{
2025-02-23 08:49:43 -06:00
public static async Task ExpireGameCacheAsync(this IFusionCache cache)
{
await cache.RemoveByTagAsync(["Games", "Depot"]);
}
public static async Task ExpireGameCacheAsync(this IFusionCache cache, Guid? gameId)
{
if (gameId.HasValue)
2025-02-09 01:37:31 -06:00
await cache.RemoveByTagAsync([ $"Games/{gameId}", "Games", "Depot"]);
2025-02-22 00:26:54 -06:00
else
await cache.RemoveByTagAsync(["Games", "Depot"]);
}
}