namespace StellaOps.Provcache; /// /// Repository interface for Provcache entries in persistent storage (Postgres). /// public interface IProvcacheRepository { /// /// Gets a cache entry by VeriKey. /// /// The cache key. /// Cancellation token. /// The cache entry if found, null otherwise. Task GetAsync(string veriKey, CancellationToken cancellationToken = default); /// /// Gets multiple cache entries by VeriKeys. /// /// The cache keys. /// Cancellation token. /// Dictionary of found entries. Task> GetManyAsync( IEnumerable veriKeys, CancellationToken cancellationToken = default); /// /// Inserts or updates a cache entry. /// /// The cache entry to upsert. /// Cancellation token. Task UpsertAsync(ProvcacheEntry entry, CancellationToken cancellationToken = default); /// /// Inserts or updates multiple cache entries in a batch. /// /// The cache entries to upsert. /// Cancellation token. Task UpsertManyAsync(IEnumerable entries, CancellationToken cancellationToken = default); /// /// Deletes a cache entry by VeriKey. /// /// The cache key. /// Cancellation token. /// True if the entry existed and was deleted. Task DeleteAsync(string veriKey, CancellationToken cancellationToken = default); /// /// Deletes entries matching a policy hash. /// Used when policy is updated. /// /// The policy hash to match. /// Cancellation token. /// Number of entries deleted. Task DeleteByPolicyHashAsync(string policyHash, CancellationToken cancellationToken = default); /// /// Deletes entries matching a signer set hash. /// Used when a signer is revoked. /// /// The signer set hash to match. /// Cancellation token. /// Number of entries deleted. Task DeleteBySignerSetHashAsync(string signerSetHash, CancellationToken cancellationToken = default); /// /// Deletes entries older than a feed epoch. /// Used when feeds are updated. /// /// The minimum feed epoch to keep. /// Cancellation token. /// Number of entries deleted. Task DeleteByFeedEpochOlderThanAsync(string feedEpoch, CancellationToken cancellationToken = default); /// /// Deletes expired entries. /// /// The reference timestamp for expiry check. /// Cancellation token. /// Number of entries deleted. Task DeleteExpiredAsync(DateTimeOffset asOf, CancellationToken cancellationToken = default); /// /// Increments the hit count for an entry. /// /// The cache key. /// Cancellation token. Task IncrementHitCountAsync(string veriKey, CancellationToken cancellationToken = default); /// /// Gets cache statistics. /// /// Cancellation token. /// Cache statistics. Task GetStatisticsAsync(CancellationToken cancellationToken = default); }