stabilizaiton work - projects rework for maintenanceability and ui livening
This commit is contained in:
@@ -71,80 +71,3 @@ public interface IProvcacheStore
|
||||
Func<CancellationToken, ValueTask<ProvcacheEntry>> factory,
|
||||
CancellationToken cancellationToken = default);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Result of a single cache lookup.
|
||||
/// </summary>
|
||||
public sealed record ProvcacheLookupResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether the entry was found in cache.
|
||||
/// </summary>
|
||||
public required bool IsHit { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The cache entry if found.
|
||||
/// </summary>
|
||||
public ProvcacheEntry? Entry { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Source of the cache hit (e.g., "valkey", "postgres").
|
||||
/// Null for cache misses.
|
||||
/// </summary>
|
||||
public string? Source { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Time taken for the lookup in milliseconds.
|
||||
/// </summary>
|
||||
public double ElapsedMs { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a cache hit result.
|
||||
/// </summary>
|
||||
public static ProvcacheLookupResult Hit(ProvcacheEntry entry, string source, double elapsedMs) => new()
|
||||
{
|
||||
IsHit = true,
|
||||
Entry = entry,
|
||||
Source = source,
|
||||
ElapsedMs = elapsedMs
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Creates a cache miss result.
|
||||
/// </summary>
|
||||
public static ProvcacheLookupResult Miss(double elapsedMs) => new()
|
||||
{
|
||||
IsHit = false,
|
||||
Entry = null,
|
||||
Source = null,
|
||||
ElapsedMs = elapsedMs
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Result of a batch cache lookup.
|
||||
/// </summary>
|
||||
public sealed record ProvcacheBatchLookupResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Entries found in cache, keyed by VeriKey.
|
||||
/// </summary>
|
||||
public required IReadOnlyDictionary<string, ProvcacheEntry> Hits { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// VeriKeys that were not found in cache.
|
||||
/// </summary>
|
||||
public required IReadOnlyList<string> Misses { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Time taken for the lookup in milliseconds.
|
||||
/// </summary>
|
||||
public double ElapsedMs { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Cache hit rate for this batch (0.0 - 1.0).
|
||||
/// </summary>
|
||||
public double HitRate => Hits.Count == 0 && Misses.Count == 0
|
||||
? 0.0
|
||||
: (double)Hits.Count / (Hits.Count + Misses.Count);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user