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,39 @@
using Microsoft.Extensions.Logging;
using System.Text.Json;
namespace StellaOps.Provcache.Valkey;
public sealed partial class ValkeyProvcacheStore
{
public async ValueTask SetAsync(ProvcacheEntry entry, CancellationToken cancellationToken = default)
{
try
{
cancellationToken.ThrowIfCancellationRequested();
var db = await GetDatabaseAsync(cancellationToken).ConfigureAwait(false);
var redisKey = BuildKey(entry.VeriKey);
var value = JsonSerializer.Serialize(entry, _jsonOptions);
var ttl = entry.ExpiresAt - _timeProvider.GetUtcNow();
if (ttl <= TimeSpan.Zero)
{
_logger.LogDebug("Skipping expired entry for VeriKey {VeriKey}", entry.VeriKey);
return;
}
if (ttl > _options.MaxTtl)
{
ttl = _options.MaxTtl;
}
await db.StringSetAsync(redisKey, value, ttl).ConfigureAwait(false);
_logger.LogDebug("Stored cache entry for VeriKey {VeriKey} with TTL {Ttl}", entry.VeriKey, ttl);
}
catch (Exception ex)
{
_logger.LogError(ex, "Error storing cache entry for VeriKey {VeriKey}", entry.VeriKey);
throw;
}
}
}