From 89ba65cf107f92ac834921dfb970165db62dadb3 Mon Sep 17 00:00:00 2001 From: nx89 Date: Fri, 13 Dec 2019 21:41:58 -0800 Subject: [PATCH] fix datetime exception --- src/EasyCaching.InMemory/Internal/InMemoryCaching.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EasyCaching.InMemory/Internal/InMemoryCaching.cs b/src/EasyCaching.InMemory/Internal/InMemoryCaching.cs index 8ea1327a..dc964451 100644 --- a/src/EasyCaching.InMemory/Internal/InMemoryCaching.cs +++ b/src/EasyCaching.InMemory/Internal/InMemoryCaching.cs @@ -107,7 +107,7 @@ public bool Add(string key, T value, TimeSpan? expiresIn = null) { ArgumentCheck.NotNullOrWhiteSpace(key, nameof(key)); - var expiresAt = expiresIn.HasValue ? SystemClock.UtcNow.SafeAdd(expiresIn.Value) : DateTime.MaxValue; + var expiresAt = expiresIn.HasValue ? SystemClock.UtcNow.SafeAdd(expiresIn.Value) : DateTimeOffset.MaxValue; return SetInternal(new CacheEntry(key, value, expiresAt), true); } @@ -115,7 +115,7 @@ public bool Set(string key, T value, TimeSpan? expiresIn = null) { ArgumentCheck.NotNullOrWhiteSpace(key, nameof(key)); - var expiresAt = expiresIn.HasValue ? SystemClock.UtcNow.SafeAdd(expiresIn.Value) : DateTime.MaxValue; + var expiresAt = expiresIn.HasValue ? SystemClock.UtcNow.SafeAdd(expiresIn.Value) : DateTimeOffset.MaxValue; return SetInternal(new CacheEntry(key, value, expiresAt)); }