using System; namespace StellaOps.Provcache; /// /// Cache metrics for monitoring and observability. /// public sealed record ProvcacheMetrics { /// /// Total cache requests since startup. /// public long TotalRequests { get; init; } /// /// Total cache hits since startup. /// public long TotalHits { get; init; } /// /// Total cache misses since startup. /// public long TotalMisses { get; init; } /// /// Cache hit rate (0.0 - 1.0). /// public double HitRate => TotalRequests == 0 ? 0.0 : (double)TotalHits / TotalRequests; /// /// Average lookup latency in milliseconds. /// public double AvgLatencyMs { get; init; } /// /// P99 lookup latency in milliseconds. /// public double P99LatencyMs { get; init; } /// /// Current number of entries in cache. /// public long CurrentEntryCount { get; init; } /// /// Total invalidations since startup. /// public long TotalInvalidations { get; init; } /// /// Valkey cache health status. /// public bool ValkeyCacheHealthy { get; init; } /// /// Postgres repository health status. /// public bool PostgresRepositoryHealthy { get; init; } /// /// Timestamp when metrics were collected. /// public DateTimeOffset CollectedAt { get; init; } }