@@ -367,7 +367,7 @@ public async Task<List<string>> GetKeysAsync(string keyPattern)
367
367
foreach ( var redisResult in arrayRedisResult )
368
368
{
369
369
var byteArray = ( RedisValue [ ] ) redisResult . Value ;
370
- MapMetadata ( byteArray , out DateTimeOffset ? absExpr , out TimeSpan ? sldExpr , out RedisValue data ) ;
370
+ MapMetadataByAutomatic ( byteArray , out DateTimeOffset ? absExpr , out TimeSpan ? sldExpr , out RedisValue data ) ;
371
371
func . Invoke ( redisResult . Key , absExpr , sldExpr ) ;
372
372
dictionary . Add ( redisResult . Key , ConvertToValue < T > ( data ) ) ;
373
373
}
@@ -535,7 +535,29 @@ private void RefreshCore(
535
535
}
536
536
}
537
537
538
- private static void MapMetadata ( RedisValue [ ] results , out DateTimeOffset ? absoluteExpiration , out TimeSpan ? slidingExpiration ,
538
+ private static void MapMetadata ( RedisValue [ ] results ,
539
+ out DateTimeOffset ? absoluteExpiration ,
540
+ out TimeSpan ? slidingExpiration ,
541
+ out RedisValue data )
542
+ {
543
+ absoluteExpiration = null ;
544
+ slidingExpiration = null ;
545
+ data = results . Length > 2 ? results [ 2 ] : RedisValue . Null ;
546
+ var absoluteExpirationTicks = ( long ? ) results [ 0 ] ;
547
+ if ( absoluteExpirationTicks . HasValue && absoluteExpirationTicks . Value != NOT_PRESENT )
548
+ {
549
+ absoluteExpiration = new DateTimeOffset ( absoluteExpirationTicks . Value , TimeSpan . Zero ) ;
550
+ }
551
+
552
+ var slidingExpirationTicks = ( long ? ) results [ 1 ] ;
553
+ if ( slidingExpirationTicks . HasValue && slidingExpirationTicks . Value != NOT_PRESENT )
554
+ {
555
+ slidingExpiration = new TimeSpan ( slidingExpirationTicks . Value ) ;
556
+ }
557
+ }
558
+
559
+ private static void MapMetadataByAutomatic ( RedisValue [ ] results , out DateTimeOffset ? absoluteExpiration ,
560
+ out TimeSpan ? slidingExpiration ,
539
561
out RedisValue data )
540
562
{
541
563
absoluteExpiration = null ;
0 commit comments