diff --git a/HttpClient.Cache.graphml b/HttpClient.Cache.graphml
new file mode 100644
index 0000000..6dbffad
--- /dev/null
+++ b/HttpClient.Cache.graphml
@@ -0,0 +1,1671 @@
+
+
+
+
+ true
+
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Organic
+
+
+
+ 0.340152426795026
+ 0
+ None
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\InMemory\Clock\DefaultSystemClock.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\InMemory\Clock\ISystemClock.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\InMemory\IMemoryCache.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\ICacheEntry.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\CacheEntryPriority.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\IChangeToken.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\PostEvictionCallbackRegistration.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\InMemory\InMemoryCacheHandler.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\Stats\ICacheStatsProvider.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\ICacheKeysProvider.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\InMemory\MemoryCache.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\InMemory\MemoryCacheOptions.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\Stats\DefaultCacheStatsProvider.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\DefaultCacheKeysProvider.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\InMemory\MemoryCacheExtensions.cs
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\Utils\HttpResponseMessageExtensions.cs
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\Utils\HttpStatusCodeExtensions.cs
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\Stats\CacheStatsReport.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\InMemory\MemoryCacheEntry.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\EvictionReason.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\Stats\CacheStatsResult.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\CacheData.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\CacheDataExtensions.cs
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\PostEvictionCallbackRegistration.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\InMemory\MemoryCacheEntryExtensions.cs
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\InMemory\MemoryCacheEntryOptions.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\Repositories\GitHub\HttpClient.Cache\src\HttpClient.Cache\CacheEntryExtensions.cs
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _responseCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _clock
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/HttpClient.Cache/CacheEntryExtensions.cs b/src/HttpClient.Cache/CacheEntryExtensions.cs
index 808e7ee..bfa26d3 100644
--- a/src/HttpClient.Cache/CacheEntryExtensions.cs
+++ b/src/HttpClient.Cache/CacheEntryExtensions.cs
@@ -1,8 +1,38 @@
namespace HttpClient.Cache;
-internal static class CacheEntryExtensions
+public static class CacheEntryExtensions
{
- internal static ICacheEntry AddExpirationToken(this ICacheEntry entry, IChangeToken token)
+ public static ICacheEntry SetValue(this ICacheEntry entry, object value)
+ {
+ entry.Value = value;
+ return entry;
+ }
+
+ public static ICacheEntry SetPriority(this ICacheEntry entry, CacheEntryPriority priority)
+ {
+ entry.Priority = priority;
+ return entry;
+ }
+
+ public static ICacheEntry SetAbsoluteExpiration(this ICacheEntry entry, DateTimeOffset expiredAt)
+ {
+ entry.AbsoluteExpiration = expiredAt;
+ return entry;
+ }
+
+ public static ICacheEntry SetAbsoluteExpiration(this ICacheEntry entry, TimeSpan expiredAt)
+ {
+ entry.AbsoluteExpirationRelativeToNow = expiredAt;
+ return entry;
+ }
+
+ public static ICacheEntry SetSlidingExpiration(this ICacheEntry entry, TimeSpan slidingExpiration)
+ {
+ entry.SlidingExpiration = slidingExpiration;
+ return entry;
+ }
+
+ public static ICacheEntry AddExpirationToken(this ICacheEntry entry, IChangeToken? token)
{
if (token == null)
{
@@ -12,4 +42,16 @@ internal static ICacheEntry AddExpirationToken(this ICacheEntry entry, IChangeTo
entry.ExpirationTokens.Add(token);
return entry;
}
+
+ public static ICacheEntry RegisterPostEvictionCallback(this ICacheEntry entry, PostEvictionDelegate? callback,
+ object? state)
+ {
+ if (callback == null)
+ {
+ throw new ArgumentNullException(nameof(callback));
+ }
+
+ entry.PostEvictionCallbacks.Add(new PostEvictionCallbackRegistration(callback, state));
+ return entry;
+ }
}
\ No newline at end of file
diff --git a/src/HttpClient.Cache/HttpClient.Cache.csproj b/src/HttpClient.Cache/HttpClient.Cache.csproj
index 240a9a0..836ad13 100644
--- a/src/HttpClient.Cache/HttpClient.Cache.csproj
+++ b/src/HttpClient.Cache/HttpClient.Cache.csproj
@@ -47,7 +47,7 @@
-
+
diff --git a/src/HttpClient.Cache/InMemory/Clock/DefaultSystemClock.cs b/src/HttpClient.Cache/InMemory/Clock/DefaultSystemClock.cs
new file mode 100644
index 0000000..3395471
--- /dev/null
+++ b/src/HttpClient.Cache/InMemory/Clock/DefaultSystemClock.cs
@@ -0,0 +1,12 @@
+namespace HttpClient.Cache.InMemory.Clock;
+
+///
+/// Presents current UTC time
+///
+internal class DefaultSystemClock: ISystemClock
+{
+ ///
+ /// Current UTC now offset.
+ ///
+ public DateTimeOffset UtcNow => DateTimeOffset.UtcNow;
+}
\ No newline at end of file
diff --git a/src/HttpClient.Cache/InMemory/Clock/SystemClock.cs b/src/HttpClient.Cache/InMemory/Clock/SystemClock.cs
deleted file mode 100644
index 3e768cc..0000000
--- a/src/HttpClient.Cache/InMemory/Clock/SystemClock.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace HttpClient.Cache.InMemory.Clock;
-
-internal class SystemClock: ISystemClock
-{
- public DateTimeOffset UtcNow => DateTimeOffset.UtcNow;
-}
\ No newline at end of file
diff --git a/src/HttpClient.Cache/InMemory/MemoryCache.cs b/src/HttpClient.Cache/InMemory/MemoryCache.cs
index aded4fc..7647afb 100644
--- a/src/HttpClient.Cache/InMemory/MemoryCache.cs
+++ b/src/HttpClient.Cache/InMemory/MemoryCache.cs
@@ -6,16 +6,16 @@ namespace HttpClient.Cache.InMemory;
public sealed class MemoryCache : IMemoryCache
{
private readonly ISystemClock _clock;
- private readonly ConcurrentDictionary