@@ -2056,49 +2056,49 @@ public Task<long> SetAddAsync(RedisKey key, RedisValue[] values, CommandFlags fl
20562056
20572057 public RedisValue [ ] SetCombine ( SetOperation operation , RedisKey first , RedisKey second , CommandFlags flags = CommandFlags . None )
20582058 {
2059- var msg = Message . Create ( Database , flags , SetOperationCommand ( operation , false ) , first , second ) ;
2059+ var msg = Message . Create ( Database , flags , operation . ToSetCommand ( ) , first , second ) ;
20602060 return ExecuteSync ( msg , ResultProcessor . RedisValueArray , defaultValue : Array . Empty < RedisValue > ( ) ) ;
20612061 }
20622062
20632063 public RedisValue [ ] SetCombine ( SetOperation operation , RedisKey [ ] keys , CommandFlags flags = CommandFlags . None )
20642064 {
2065- var msg = Message . Create ( Database , flags , SetOperationCommand ( operation , false ) , keys ) ;
2065+ var msg = Message . Create ( Database , flags , operation . ToSetCommand ( ) , keys ) ;
20662066 return ExecuteSync ( msg , ResultProcessor . RedisValueArray , defaultValue : Array . Empty < RedisValue > ( ) ) ;
20672067 }
20682068
20692069 public long SetCombineAndStore ( SetOperation operation , RedisKey destination , RedisKey first , RedisKey second , CommandFlags flags = CommandFlags . None )
20702070 {
2071- var msg = Message . Create ( Database , flags , SetOperationCommand ( operation , true ) , destination , first , second ) ;
2071+ var msg = Message . Create ( Database , flags , operation . ToSetStoreCommand ( ) , destination , first , second ) ;
20722072 return ExecuteSync ( msg , ResultProcessor . Int64 ) ;
20732073 }
20742074
20752075 public long SetCombineAndStore ( SetOperation operation , RedisKey destination , RedisKey [ ] keys , CommandFlags flags = CommandFlags . None )
20762076 {
2077- var msg = Message . Create ( Database , flags , SetOperationCommand ( operation , true ) , destination , keys ) ;
2077+ var msg = Message . Create ( Database , flags , operation . ToSetStoreCommand ( ) , destination , keys ) ;
20782078 return ExecuteSync ( msg , ResultProcessor . Int64 ) ;
20792079 }
20802080
20812081 public Task < long > SetCombineAndStoreAsync ( SetOperation operation , RedisKey destination , RedisKey first , RedisKey second , CommandFlags flags = CommandFlags . None )
20822082 {
2083- var msg = Message . Create ( Database , flags , SetOperationCommand ( operation , true ) , destination , first , second ) ;
2083+ var msg = Message . Create ( Database , flags , operation . ToSetStoreCommand ( ) , destination , first , second ) ;
20842084 return ExecuteAsync ( msg , ResultProcessor . Int64 ) ;
20852085 }
20862086
20872087 public Task < long > SetCombineAndStoreAsync ( SetOperation operation , RedisKey destination , RedisKey [ ] keys , CommandFlags flags = CommandFlags . None )
20882088 {
2089- var msg = Message . Create ( Database , flags , SetOperationCommand ( operation , true ) , destination , keys ) ;
2089+ var msg = Message . Create ( Database , flags , operation . ToSetStoreCommand ( ) , destination , keys ) ;
20902090 return ExecuteAsync ( msg , ResultProcessor . Int64 ) ;
20912091 }
20922092
20932093 public Task < RedisValue [ ] > SetCombineAsync ( SetOperation operation , RedisKey first , RedisKey second , CommandFlags flags = CommandFlags . None )
20942094 {
2095- var msg = Message . Create ( Database , flags , SetOperationCommand ( operation , false ) , first , second ) ;
2095+ var msg = Message . Create ( Database , flags , operation . ToSetCommand ( ) , first , second ) ;
20962096 return ExecuteAsync ( msg , ResultProcessor . RedisValueArray , defaultValue : Array . Empty < RedisValue > ( ) ) ;
20972097 }
20982098
20992099 public Task < RedisValue [ ] > SetCombineAsync ( SetOperation operation , RedisKey [ ] keys , CommandFlags flags = CommandFlags . None )
21002100 {
2101- var msg = Message . Create ( Database , flags , SetOperationCommand ( operation , false ) , keys ) ;
2101+ var msg = Message . Create ( Database , flags , operation . ToSetCommand ( ) , keys ) ;
21022102 return ExecuteAsync ( msg , ResultProcessor . RedisValueArray , defaultValue : Array . Empty < RedisValue > ( ) ) ;
21032103 }
21042104
@@ -4516,7 +4516,7 @@ private Message GetSortMessage(RedisKey destination, RedisKey key, long skip, lo
45164516
45174517 private Message GetSortedSetCombineAndStoreCommandMessage ( SetOperation operation , RedisKey destination , RedisKey [ ] keys , double [ ] ? weights , Aggregate aggregate , CommandFlags flags )
45184518 {
4519- var command = operation . ToStoreCommand ( ) ;
4519+ var command = operation . ToSortedSetStoreCommand ( ) ;
45204520 if ( keys == null )
45214521 {
45224522 throw new ArgumentNullException ( nameof ( keys ) ) ;
@@ -4589,7 +4589,7 @@ private Message GetSortedSetLengthMessage(RedisKey key, double min, double max,
45894589 }
45904590
45914591 private Message GetSortedSetIntersectionLengthMessage ( RedisKey [ ] keys , long limit , CommandFlags flags )
4592- => new SetOperationCardinalityMessage ( Database , flags , SetOperation . Intersect , keys , limit ) ;
4592+ => new SetOperationCardinalityMessage ( Database , flags , RedisCommand . ZINTERCARD , keys , limit ) ;
45934593
45944594 private Message GetSortedSetRangeByScoreMessage ( RedisKey key , double start , double stop , Exclude exclude , Order order , long skip , long take , CommandFlags flags , bool withScores )
45954595 {
@@ -5299,14 +5299,6 @@ private Message GetStringSetAndGetMessage(
52995299 _ => Message . Create ( Database , flags , RedisCommand . DECRBY , key , - value ) ,
53005300 } ;
53015301
5302- private static RedisCommand SetOperationCommand ( SetOperation operation , bool store ) => operation switch
5303- {
5304- SetOperation . Difference => store ? RedisCommand . SDIFFSTORE : RedisCommand . SDIFF ,
5305- SetOperation . Intersect => store ? RedisCommand . SINTERSTORE : RedisCommand . SINTER ,
5306- SetOperation . Union => store ? RedisCommand . SUNIONSTORE : RedisCommand . SUNION ,
5307- _ => throw new ArgumentOutOfRangeException ( nameof ( operation ) ) ,
5308- } ;
5309-
53105302 private CursorEnumerable < T > ? TryScan < T > ( RedisKey key , RedisValue pattern , int pageSize , long cursor , int pageOffset , CommandFlags flags , RedisCommand command , ResultProcessor < ScanEnumerable < T > . ScanResult > processor , out ServerEndPoint ? server , bool noValues = false )
53115303 {
53125304 server = null ;
0 commit comments