namespace StellaOps.Provcache;
///
/// Result of a single cache lookup.
///
public sealed record ProvcacheLookupResult
{
///
/// Whether the entry was found in cache.
///
public required bool IsHit { get; init; }
///
/// The cache entry if found.
///
public ProvcacheEntry? Entry { get; init; }
///
/// Source of the cache hit (e.g., "valkey", "postgres").
/// Null for cache misses.
///
public string? Source { get; init; }
///
/// Time taken for the lookup in milliseconds.
///
public double ElapsedMs { get; init; }
///
/// Creates a cache hit result.
///
public static ProvcacheLookupResult Hit(ProvcacheEntry entry, string source, double elapsedMs) => new()
{
IsHit = true,
Entry = entry,
Source = source,
ElapsedMs = elapsedMs
};
///
/// Creates a cache miss result.
///
public static ProvcacheLookupResult Miss(double elapsedMs) => new()
{
IsHit = false,
Entry = null,
Source = null,
ElapsedMs = elapsedMs
};
}