stabilizaiton work - projects rework for maintenanceability and ui livening

This commit is contained in:
master
2026-02-03 23:40:04 +02:00
parent 074ce117ba
commit 557feefdc3
3305 changed files with 186813 additions and 107843 deletions

View File

@@ -0,0 +1,33 @@
using System;
using System.Threading;
using System.Threading.Tasks;
namespace StellaOps.Provcache;
public sealed partial class ProvcacheService
{
/// <inheritdoc />
public async Task<ProvcacheEntry> GetOrComputeAsync(
string veriKey,
Func<CancellationToken, Task<ProvcacheEntry>> factory,
bool bypassCache = false,
CancellationToken cancellationToken = default)
{
ArgumentException.ThrowIfNullOrWhiteSpace(veriKey);
ArgumentNullException.ThrowIfNull(factory);
if (!bypassCache || !_options.AllowCacheBypass)
{
var result = await GetAsync(veriKey, bypassCache: false, cancellationToken).ConfigureAwait(false);
if (result.WasCached && result.Entry is not null)
{
return result.Entry;
}
}
var entry = await factory(cancellationToken).ConfigureAwait(false);
await SetAsync(entry, cancellationToken).ConfigureAwait(false);
return entry;
}
}