diff --git a/src/HttpClient.Cache/ICacheEntry.cs b/src/HttpClient.Cache/ICacheEntry.cs index b447493..63a2a48 100644 --- a/src/HttpClient.Cache/ICacheEntry.cs +++ b/src/HttpClient.Cache/ICacheEntry.cs @@ -1,18 +1,44 @@ namespace HttpClient.Cache; +/// +/// Cache value holder +/// public interface ICacheEntry: IDisposable { + /// + /// Cache value + /// object Value { get; set; } + /// + /// Cache entry priority + /// + CacheEntryPriority Priority { get; set; } + + /// + /// Entry absolute expiration. The entry will be expired after a set amount of time + /// DateTimeOffset? AbsoluteExpiration { get; set; } + /// + /// Entry absolute expiration relative to created time. The entry will be expired a set amount of time from now + /// TimeSpan? AbsoluteExpirationRelativeToNow { get; set; } + /// + /// Entry sliding expiration. Entry will be expired if it hasn't been accessed in a set amount of time. + /// TimeSpan? SlidingExpiration { get; set; } + /// + /// Collection of tokens. + /// Any lifecycle changes will appear here + /// IList ExpirationTokens { get; } + /// + /// Collection of callbacks. + /// Will be executed on entry eviction + /// IList PostEvictionCallbacks { get; } - - CacheEntryPriority Priority { get; set; } } \ No newline at end of file diff --git a/src/HttpClient.Cache/ICacheKeysProvider.cs b/src/HttpClient.Cache/ICacheKeysProvider.cs index 317249d..0e7c76a 100644 --- a/src/HttpClient.Cache/ICacheKeysProvider.cs +++ b/src/HttpClient.Cache/ICacheKeysProvider.cs @@ -1,6 +1,14 @@ namespace HttpClient.Cache; +/// +/// Cache keys generator +/// public interface ICacheKeysProvider { + /// + /// Generate a cache key for http request + /// + /// Http request + /// Cache key string GetKey(HttpRequestMessage request); } \ No newline at end of file diff --git a/src/HttpClient.Cache/IChangeToken.cs b/src/HttpClient.Cache/IChangeToken.cs index b9df011..0b31528 100644 --- a/src/HttpClient.Cache/IChangeToken.cs +++ b/src/HttpClient.Cache/IChangeToken.cs @@ -1,10 +1,25 @@ namespace HttpClient.Cache; +/// +/// Defines the mechanism for checking the changes over the cache entry +/// public interface IChangeToken { + /// + /// Cache entry is changed + /// bool HasChanged { get; } + /// + /// Call the callback on change + /// bool ActiveChangeCallbacks { get; } + /// + /// Register a callback to call on change + /// + /// Callback to call + /// Current state + /// callback handler IDisposable RegisterChangeCallback(Action callback, object state); } \ No newline at end of file diff --git a/src/HttpClient.Cache/InMemory/Clock/ISystemClock.cs b/src/HttpClient.Cache/InMemory/Clock/ISystemClock.cs index 8662ee2..7249d96 100644 --- a/src/HttpClient.Cache/InMemory/Clock/ISystemClock.cs +++ b/src/HttpClient.Cache/InMemory/Clock/ISystemClock.cs @@ -1,6 +1,12 @@ namespace HttpClient.Cache.InMemory.Clock; +/// +/// Defines cache clock +/// public interface ISystemClock { + /// + /// Current time + /// DateTimeOffset UtcNow { get; } } \ No newline at end of file diff --git a/src/HttpClient.Cache/InMemory/IMemoryCache.cs b/src/HttpClient.Cache/InMemory/IMemoryCache.cs index b054304..d9b2a21 100644 --- a/src/HttpClient.Cache/InMemory/IMemoryCache.cs +++ b/src/HttpClient.Cache/InMemory/IMemoryCache.cs @@ -1,12 +1,33 @@ namespace HttpClient.Cache.InMemory; +/// +/// Describes the API for InMemory cache +/// public interface IMemoryCache: IDisposable { + /// + /// Getting the cache value by key + /// + /// Entry key + /// Cache value + /// True if entry exist and returned, otherwise - false bool TryGetValue(object key, out object? value); + /// + /// Create empty cache entry + /// + /// Entry key + /// cache entry ICacheEntry CreateEntry(object key); + /// + /// Remove entry by key + /// + /// Entry key void Remove(object key); + /// + /// Clean the cache + /// void Clear(); } \ No newline at end of file diff --git a/src/HttpClient.Cache/Stats/ICacheStatsProvider.cs b/src/HttpClient.Cache/Stats/ICacheStatsProvider.cs index c6361f0..d00569e 100644 --- a/src/HttpClient.Cache/Stats/ICacheStatsProvider.cs +++ b/src/HttpClient.Cache/Stats/ICacheStatsProvider.cs @@ -2,11 +2,26 @@ namespace HttpClient.Cache.Stats; +/// +/// Defines a mechanism to report cache hit/miss and generate on this info a cache report +/// public interface ICacheStatsProvider { + /// + /// Mark a cache hit + /// + /// Target code void ReportHit(HttpStatusCode code); + /// + /// Mark a cache miss + /// + /// Target code void ReportMiss(HttpStatusCode code); + /// + /// Gets stored cache report + /// + /// report CacheStatsReport GetReport(); } \ No newline at end of file