namespace StellaOps.Provcache;
///
/// Cache store interface for Provcache with read-through semantics.
/// Abstracts the caching layer (Valkey, in-memory, etc.).
///
public interface IProvcacheStore
{
///
/// Gets the store provider name for diagnostics.
///
string ProviderName { get; }
///
/// Gets a cache entry by VeriKey.
///
/// The cache key.
/// Cancellation token.
/// Cache result indicating hit/miss with the entry if found.
ValueTask GetAsync(string veriKey, CancellationToken cancellationToken = default);
///
/// Gets multiple cache entries by VeriKeys.
///
/// The cache keys.
/// Cancellation token.
/// Dictionary of found entries and list of misses.
ValueTask GetManyAsync(
IEnumerable veriKeys,
CancellationToken cancellationToken = default);
///
/// Sets a cache entry.
///
/// The cache entry to set.
/// Cancellation token.
ValueTask SetAsync(ProvcacheEntry entry, CancellationToken cancellationToken = default);
///
/// Sets multiple cache entries in a batch.
///
/// The cache entries to set.
/// Cancellation token.
ValueTask SetManyAsync(IEnumerable entries, CancellationToken cancellationToken = default);
///
/// Invalidates a cache entry by VeriKey.
///
/// The cache key.
/// Cancellation token.
/// True if the entry existed and was invalidated.
ValueTask InvalidateAsync(string veriKey, CancellationToken cancellationToken = default);
///
/// Invalidates entries matching a key pattern.
///
/// The key pattern (supports wildcards).
/// Cancellation token.
/// Number of entries invalidated.
ValueTask InvalidateByPatternAsync(string pattern, CancellationToken cancellationToken = default);
///
/// Gets or sets a cache entry using a factory function for cache misses.
///
/// The cache key.
/// Factory function to create the entry on cache miss.
/// Cancellation token.
/// The cached or newly created entry.
ValueTask GetOrSetAsync(
string veriKey,
Func> factory,
CancellationToken cancellationToken = default);
}