@@ -49,8 +49,8 @@ public void Clear(string prefix = "")
49
49
public int GetCount ( string prefix = "" )
50
50
{
51
51
return string . IsNullOrWhiteSpace ( prefix )
52
- ? _memory . Count
53
- : _memory . Count ( x => x . Key . StartsWith ( prefix , StringComparison . OrdinalIgnoreCase ) ) ;
52
+ ? _memory . Values . Where ( x => x . ExpiresAt > SystemClock . UtcNow ) . Count ( )
53
+ : _memory . Values . Where ( x => x . Key . StartsWith ( prefix , StringComparison . OrdinalIgnoreCase ) && x . ExpiresAt > SystemClock . UtcNow ) . Count ( ) ;
54
54
}
55
55
56
56
internal void RemoveExpiredKey ( string key )
@@ -283,7 +283,7 @@ public int RemoveByPattern(string searchKey, SearchKeyPattern searchPattern)
283
283
public IEnumerable < string > GetAllKeys ( string prefix )
284
284
{
285
285
return _memory . Values . Where ( x => x . Key . StartsWith ( prefix , StringComparison . OrdinalIgnoreCase ) && x . ExpiresAt > SystemClock . UtcNow )
286
- . Select ( x=> x . Key ) . ToList ( ) ;
286
+ . Select ( x => x . Key ) . ToList ( ) ;
287
287
}
288
288
289
289
private static bool FilterByPattern ( string key , string searchKey , SearchKeyPattern searchKeyPattern )
@@ -314,10 +314,10 @@ public IDictionary<string, CacheValue<T>> GetAll<T>(IEnumerable<string> keys)
314
314
315
315
public IDictionary < string , CacheValue < T > > GetAll < T > ( string prefix = "" )
316
316
{
317
- var values = string . IsNullOrEmpty ( prefix )
318
- ? _memory . Values . Where ( x => x . ExpiresAt > SystemClock . UtcNow )
317
+ var values = string . IsNullOrEmpty ( prefix )
318
+ ? _memory . Values . Where ( x => x . ExpiresAt > SystemClock . UtcNow )
319
319
: _memory . Values . Where ( x => x . Key . StartsWith ( prefix , StringComparison . OrdinalIgnoreCase ) && x . ExpiresAt > SystemClock . UtcNow ) ;
320
-
320
+
321
321
return values . ToDictionary ( k => k . Key , v => new CacheValue < T > ( v . GetValue < T > ( _options . EnableReadDeepClone ) , true ) ) ;
322
322
}
323
323
0 commit comments