@@ -725,17 +725,11 @@ public bool TrySet<T>(string cacheKey, T cacheValue, TimeSpan expiration)
725
725
ArgumentCheck . NotNull ( cacheValue , nameof ( cacheValue ) ) ;
726
726
ArgumentCheck . NotNegativeOrZero ( expiration , nameof ( expiration ) ) ;
727
727
728
- if ( _cacheKeys . Contains ( cacheKey ) )
728
+ if ( _cacheKeys . Contains ( BuildCacheKey ( Name , cacheKey ) ) )
729
729
{
730
730
return false ;
731
731
}
732
732
733
- if ( MaxRdSecond > 0 )
734
- {
735
- var addSec = new Random ( ) . Next ( 1 , MaxRdSecond ) ;
736
- expiration . Add ( new TimeSpan ( 0 , 0 , addSec ) ) ;
737
- }
738
-
739
733
Set ( cacheKey , cacheValue , expiration ) ;
740
734
return true ;
741
735
}
@@ -754,17 +748,11 @@ public async Task<bool> TrySetAsync<T>(string cacheKey, T cacheValue, TimeSpan e
754
748
ArgumentCheck . NotNull ( cacheValue , nameof ( cacheValue ) ) ;
755
749
ArgumentCheck . NotNegativeOrZero ( expiration , nameof ( expiration ) ) ;
756
750
757
- if ( _cacheKeys . Contains ( cacheKey ) )
751
+ if ( _cacheKeys . Contains ( BuildCacheKey ( Name , cacheKey ) ) )
758
752
{
759
753
return false ;
760
754
}
761
755
762
- if ( MaxRdSecond > 0 )
763
- {
764
- var addSec = new Random ( ) . Next ( 1 , MaxRdSecond ) ;
765
- expiration . Add ( new TimeSpan ( 0 , 0 , addSec ) ) ;
766
- }
767
-
768
756
await SetAsync ( cacheKey , cacheValue , expiration ) ;
769
757
return true ;
770
758
}
0 commit comments