@@ -113,7 +113,7 @@ public override bool BaseExists(string cacheKey)
113
113
{
114
114
ArgumentCheck . NotNullOrWhiteSpace ( cacheKey , nameof ( cacheKey ) ) ;
115
115
116
- var dbResult = _cache . Count ( fc => fc . cachekey == cacheKey && fc . expiration > DateTimeOffset . Now . ToUnixTimeSeconds ( ) ) ;
116
+ var dbResult = _cache . Count ( fc => fc . cachekey == cacheKey && fc . expiration > DateTimeOffset . UtcNow . ToUnixTimeSeconds ( ) ) ;
117
117
118
118
return dbResult > 0 ;
119
119
}
@@ -131,7 +131,7 @@ public override CacheValue<T> BaseGet<T>(string cacheKey, Func<T> dataRetriever,
131
131
ArgumentCheck . NotNullOrWhiteSpace ( cacheKey , nameof ( cacheKey ) ) ;
132
132
ArgumentCheck . NotNegativeOrZero ( expiration , nameof ( expiration ) ) ;
133
133
134
- var cacheItem = _cache . FindOne ( c => c . cachekey == cacheKey && c . expiration > DateTimeOffset . Now . ToUnixTimeSeconds ( ) ) ;
134
+ var cacheItem = _cache . FindOne ( c => c . cachekey == cacheKey && c . expiration > DateTimeOffset . UtcNow . ToUnixTimeSeconds ( ) ) ;
135
135
136
136
if ( cacheItem != null )
137
137
{
@@ -164,7 +164,7 @@ public override CacheValue<T> BaseGet<T>(string cacheKey)
164
164
{
165
165
ArgumentCheck . NotNullOrWhiteSpace ( cacheKey , nameof ( cacheKey ) ) ;
166
166
167
- var cacheItem = _cache . FindOne ( c => c . cachekey == cacheKey && c . expiration > DateTimeOffset . Now . ToUnixTimeSeconds ( ) ) ;
167
+ var cacheItem = _cache . FindOne ( c => c . cachekey == cacheKey && c . expiration > DateTimeOffset . UtcNow . ToUnixTimeSeconds ( ) ) ;
168
168
169
169
if ( cacheItem != null || _options . CacheNulls )
170
170
{
@@ -317,7 +317,7 @@ public override IDictionary<string, CacheValue<T>> BaseGetAll<T>(IEnumerable<str
317
317
{
318
318
ArgumentCheck . NotNullAndCountGTZero ( cacheKeys , nameof ( cacheKeys ) ) ;
319
319
var lst = cacheKeys . ToList ( ) ;
320
- var list = _cache . Find ( c => lst . Contains ( c . cachekey ) && c . expiration > DateTimeOffset . Now . ToUnixTimeSeconds ( ) ) . ToList ( ) ;
320
+ var list = _cache . Find ( c => lst . Contains ( c . cachekey ) && c . expiration > DateTimeOffset . UtcNow . ToUnixTimeSeconds ( ) ) . ToList ( ) ;
321
321
return GetDict < T > ( list ) ;
322
322
}
323
323
@@ -354,7 +354,7 @@ private IDictionary<string, CacheValue<T>> GetDict<T>(List<CacheItem> list)
354
354
public override IDictionary < string , CacheValue < T > > BaseGetByPrefix < T > ( string prefix )
355
355
{
356
356
ArgumentCheck . NotNullOrWhiteSpace ( prefix , nameof ( prefix ) ) ;
357
- var list = _cache . Find ( c => c . cachekey . StartsWith ( prefix ) && c . expiration > DateTimeOffset . Now . ToUnixTimeSeconds ( ) ) . ToList ( ) ;
357
+ var list = _cache . Find ( c => c . cachekey . StartsWith ( prefix ) && c . expiration > DateTimeOffset . UtcNow . ToUnixTimeSeconds ( ) ) . ToList ( ) ;
358
358
return GetDict < T > ( list ) ;
359
359
}
360
360
@@ -380,11 +380,11 @@ public override int BaseGetCount(string prefix = "")
380
380
{
381
381
if ( string . IsNullOrWhiteSpace ( prefix ) )
382
382
{
383
- return _cache . Count ( c => c . expiration > DateTimeOffset . Now . ToUnixTimeSeconds ( ) ) ;
383
+ return _cache . Count ( c => c . expiration > DateTimeOffset . UtcNow . ToUnixTimeSeconds ( ) ) ;
384
384
}
385
385
else
386
386
{
387
- return _cache . Count ( c => c . cachekey . StartsWith ( prefix ) && c . expiration > DateTimeOffset . Now . ToUnixTimeSeconds ( ) ) ;
387
+ return _cache . Count ( c => c . cachekey . StartsWith ( prefix ) && c . expiration > DateTimeOffset . UtcNow . ToUnixTimeSeconds ( ) ) ;
388
388
}
389
389
}
390
390
@@ -413,7 +413,7 @@ public override bool BaseTrySet<T>(string cacheKey, T cacheValue, TimeSpan expir
413
413
expiration . Add ( new TimeSpan ( 0 , 0 , addSec ) ) ;
414
414
}
415
415
416
- var r = _cache . FindOne ( c => c . cachekey == cacheKey && c . expiration > DateTimeOffset . Now . ToUnixTimeSeconds ( ) ) ;
416
+ var r = _cache . FindOne ( c => c . cachekey == cacheKey && c . expiration > DateTimeOffset . UtcNow . ToUnixTimeSeconds ( ) ) ;
417
417
bool result = false ;
418
418
if ( r == null )
419
419
{
0 commit comments