@@ -366,17 +366,7 @@ public struct MIGRATE<Host: RESPStringRenderable>: ValkeyCommand {
366
366
public var authentication : Authentication ?
367
367
public var keys : [ ValkeyKey ]
368
368
369
- @inlinable public init (
370
- host: Host ,
371
- port: Int ,
372
- keySelector: KeySelector ,
373
- destinationDb: Int ,
374
- timeout: Int ,
375
- copy: Bool = false ,
376
- replace: Bool = false ,
377
- authentication: Authentication ? = nil ,
378
- keys: [ ValkeyKey ] = [ ]
379
- ) {
369
+ @inlinable public init ( host: Host , port: Int , keySelector: KeySelector , destinationDb: Int , timeout: Int , copy: Bool = false , replace: Bool = false , authentication: Authentication ? = nil , keys: [ ValkeyKey ] = [ ] ) {
380
370
self . host = host
381
371
self . port = port
382
372
self . keySelector = keySelector
@@ -391,18 +381,7 @@ public struct MIGRATE<Host: RESPStringRenderable>: ValkeyCommand {
391
381
public var keysAffected : [ ValkeyKey ] { keys }
392
382
393
383
@inlinable public func encode( into commandEncoder: inout ValkeyCommandEncoder ) {
394
- commandEncoder. encodeArray (
395
- " MIGRATE " ,
396
- RESPBulkString ( host) ,
397
- port,
398
- keySelector,
399
- destinationDb,
400
- timeout,
401
- RESPPureToken ( " COPY " , copy) ,
402
- RESPPureToken ( " REPLACE " , replace) ,
403
- authentication,
404
- RESPWithToken ( " KEYS " , keys)
405
- )
384
+ commandEncoder. encodeArray ( " MIGRATE " , RESPBulkString ( host) , port, keySelector, destinationDb, timeout, RESPPureToken ( " COPY " , copy) , RESPPureToken ( " REPLACE " , replace) , authentication, RESPWithToken ( " KEYS " , keys) )
406
385
}
407
386
}
408
387
@@ -614,15 +593,7 @@ public struct RESTORE<SerializedValue: RESPStringRenderable>: ValkeyCommand {
614
593
public var seconds : Int ?
615
594
public var frequency : Int ?
616
595
617
- @inlinable public init (
618
- key: ValkeyKey ,
619
- ttl: Int ,
620
- serializedValue: SerializedValue ,
621
- replace: Bool = false ,
622
- absttl: Bool = false ,
623
- seconds: Int ? = nil ,
624
- frequency: Int ? = nil
625
- ) {
596
+ @inlinable public init ( key: ValkeyKey , ttl: Int , serializedValue: SerializedValue , replace: Bool = false , absttl: Bool = false , seconds: Int ? = nil , frequency: Int ? = nil ) {
626
597
self . key = key
627
598
self . ttl = ttl
628
599
self . serializedValue = serializedValue
@@ -635,16 +606,7 @@ public struct RESTORE<SerializedValue: RESPStringRenderable>: ValkeyCommand {
635
606
public var keysAffected : CollectionOfOne < ValkeyKey > { . init( key) }
636
607
637
608
@inlinable public func encode( into commandEncoder: inout ValkeyCommandEncoder ) {
638
- commandEncoder. encodeArray (
639
- " RESTORE " ,
640
- key,
641
- ttl,
642
- RESPBulkString ( serializedValue) ,
643
- RESPPureToken ( " REPLACE " , replace) ,
644
- RESPPureToken ( " ABSTTL " , absttl) ,
645
- RESPWithToken ( " IDLETIME " , seconds) ,
646
- RESPWithToken ( " FREQ " , frequency)
647
- )
609
+ commandEncoder. encodeArray ( " RESTORE " , key, ttl, RESPBulkString ( serializedValue) , RESPPureToken ( " REPLACE " , replace) , RESPPureToken ( " ABSTTL " , absttl) , RESPWithToken ( " IDLETIME " , seconds) , RESPWithToken ( " FREQ " , frequency) )
648
610
}
649
611
}
650
612
@@ -714,15 +676,7 @@ public struct SORT: ValkeyCommand {
714
676
public var sorting : Bool
715
677
public var destination : ValkeyKey ?
716
678
717
- @inlinable public init (
718
- key: ValkeyKey ,
719
- byPattern: String ? = nil ,
720
- limit: Limit ? = nil ,
721
- getPattern: [ String ] = [ ] ,
722
- order: Order ? = nil ,
723
- sorting: Bool = false ,
724
- destination: ValkeyKey ? = nil
725
- ) {
679
+ @inlinable public init ( key: ValkeyKey , byPattern: String ? = nil , limit: Limit ? = nil , getPattern: [ String ] = [ ] , order: Order ? = nil , sorting: Bool = false , destination: ValkeyKey ? = nil ) {
726
680
self . key = key
727
681
self . byPattern = byPattern
728
682
self . limit = limit
@@ -735,16 +689,7 @@ public struct SORT: ValkeyCommand {
735
689
public var keysAffected : [ ValkeyKey ] { [ key] + ( destination. map { [ $0] } ?? [ ] ) }
736
690
737
691
@inlinable public func encode( into commandEncoder: inout ValkeyCommandEncoder ) {
738
- commandEncoder. encodeArray (
739
- " SORT " ,
740
- key,
741
- RESPWithToken ( " BY " , byPattern) ,
742
- RESPWithToken ( " LIMIT " , limit) ,
743
- RESPWithToken ( " GET " , getPattern) ,
744
- order,
745
- RESPPureToken ( " ALPHA " , sorting) ,
746
- RESPWithToken ( " STORE " , destination)
747
- )
692
+ commandEncoder. encodeArray ( " SORT " , key, RESPWithToken ( " BY " , byPattern) , RESPWithToken ( " LIMIT " , limit) , RESPWithToken ( " GET " , getPattern) , order, RESPPureToken ( " ALPHA " , sorting) , RESPWithToken ( " STORE " , destination) )
748
693
}
749
694
}
750
695
@@ -794,14 +739,7 @@ public struct SORTRO: ValkeyCommand {
794
739
public var order : Order ?
795
740
public var sorting : Bool
796
741
797
- @inlinable public init (
798
- key: ValkeyKey ,
799
- byPattern: String ? = nil ,
800
- limit: Limit ? = nil ,
801
- getPattern: [ String ] = [ ] ,
802
- order: Order ? = nil ,
803
- sorting: Bool = false
804
- ) {
742
+ @inlinable public init ( key: ValkeyKey , byPattern: String ? = nil , limit: Limit ? = nil , getPattern: [ String ] = [ ] , order: Order ? = nil , sorting: Bool = false ) {
805
743
self . key = key
806
744
self . byPattern = byPattern
807
745
self . limit = limit
@@ -813,15 +751,7 @@ public struct SORTRO: ValkeyCommand {
813
751
public var keysAffected : CollectionOfOne < ValkeyKey > { . init( key) }
814
752
815
753
@inlinable public func encode( into commandEncoder: inout ValkeyCommandEncoder ) {
816
- commandEncoder. encodeArray (
817
- " SORT_RO " ,
818
- key,
819
- RESPWithToken ( " BY " , byPattern) ,
820
- RESPWithToken ( " LIMIT " , limit) ,
821
- RESPWithToken ( " GET " , getPattern) ,
822
- order,
823
- RESPPureToken ( " ALPHA " , sorting)
824
- )
754
+ commandEncoder. encodeArray ( " SORT_RO " , key, RESPWithToken ( " BY " , byPattern) , RESPWithToken ( " LIMIT " , limit) , RESPWithToken ( " GET " , getPattern) , order, RESPPureToken ( " ALPHA " , sorting) )
825
755
}
826
756
}
827
757
@@ -1053,30 +983,8 @@ extension ValkeyConnectionProtocol {
1053
983
/// * "OK": Success.
1054
984
/// * "NOKEY": No keys were found in the source instance.
1055
985
@inlinable
1056
- public func migrate< Host: RESPStringRenderable > (
1057
- host: Host ,
1058
- port: Int ,
1059
- keySelector: MIGRATE < Host > . KeySelector ,
1060
- destinationDb: Int ,
1061
- timeout: Int ,
1062
- copy: Bool = false ,
1063
- replace: Bool = false ,
1064
- authentication: MIGRATE < Host > . Authentication ? = nil ,
1065
- keys: [ ValkeyKey ] = [ ]
1066
- ) async throws -> String ? {
1067
- try await send (
1068
- command: MIGRATE (
1069
- host: host,
1070
- port: port,
1071
- keySelector: keySelector,
1072
- destinationDb: destinationDb,
1073
- timeout: timeout,
1074
- copy: copy,
1075
- replace: replace,
1076
- authentication: authentication,
1077
- keys: keys
1078
- )
1079
- )
986
+ public func migrate< Host: RESPStringRenderable > ( host: Host , port: Int , keySelector: MIGRATE < Host > . KeySelector , destinationDb: Int , timeout: Int , copy: Bool = false , replace: Bool = false , authentication: MIGRATE < Host > . Authentication ? = nil , keys: [ ValkeyKey ] = [ ] ) async throws -> String ? {
987
+ try await send ( command: MIGRATE ( host: host, port: port, keySelector: keySelector, destinationDb: destinationDb, timeout: timeout, copy: copy, replace: replace, authentication: authentication, keys: keys) )
1080
988
}
1081
989
1082
990
/// Moves a key to another database.
@@ -1270,26 +1178,8 @@ extension ValkeyConnectionProtocol {
1270
1178
/// * 5.0.0: Added the `IDLETIME` and `FREQ` options.
1271
1179
/// - Complexity: O(1) to create the new key and additional O(N*M) to reconstruct the serialized value, where N is the number of objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1). However for sorted set values the complexity is O(N*M*log(N)) because inserting values into sorted sets is O(log(N)).
1272
1180
@inlinable
1273
- public func restore< SerializedValue: RESPStringRenderable > (
1274
- key: ValkeyKey ,
1275
- ttl: Int ,
1276
- serializedValue: SerializedValue ,
1277
- replace: Bool = false ,
1278
- absttl: Bool = false ,
1279
- seconds: Int ? = nil ,
1280
- frequency: Int ? = nil
1281
- ) async throws {
1282
- _ = try await send (
1283
- command: RESTORE (
1284
- key: key,
1285
- ttl: ttl,
1286
- serializedValue: serializedValue,
1287
- replace: replace,
1288
- absttl: absttl,
1289
- seconds: seconds,
1290
- frequency: frequency
1291
- )
1292
- )
1181
+ public func restore< SerializedValue: RESPStringRenderable > ( key: ValkeyKey , ttl: Int , serializedValue: SerializedValue , replace: Bool = false , absttl: Bool = false , seconds: Int ? = nil , frequency: Int ? = nil ) async throws {
1182
+ _ = try await send ( command: RESTORE ( key: key, ttl: ttl, serializedValue: serializedValue, replace: replace, absttl: absttl, seconds: seconds, frequency: frequency) )
1293
1183
}
1294
1184
1295
1185
/// Iterates over the key names in the database.
@@ -1314,26 +1204,8 @@ extension ValkeyConnectionProtocol {
1314
1204
/// * [Integer]: When the store option is specified the command returns the number of sorted elements in the destination list.
1315
1205
/// * [Array]: When not passing the store option the command returns a list of sorted elements.
1316
1206
@inlinable
1317
- public func sort(
1318
- key: ValkeyKey ,
1319
- byPattern: String ? = nil ,
1320
- limit: SORT . Limit ? = nil ,
1321
- getPattern: [ String ] = [ ] ,
1322
- order: SORT . Order ? = nil ,
1323
- sorting: Bool = false ,
1324
- destination: ValkeyKey ? = nil
1325
- ) async throws -> SORT . Response {
1326
- try await send (
1327
- command: SORT (
1328
- key: key,
1329
- byPattern: byPattern,
1330
- limit: limit,
1331
- getPattern: getPattern,
1332
- order: order,
1333
- sorting: sorting,
1334
- destination: destination
1335
- )
1336
- )
1207
+ public func sort( key: ValkeyKey , byPattern: String ? = nil , limit: SORT . Limit ? = nil , getPattern: [ String ] = [ ] , order: SORT . Order ? = nil , sorting: Bool = false , destination: ValkeyKey ? = nil ) async throws -> SORT . Response {
1208
+ try await send ( command: SORT ( key: key, byPattern: byPattern, limit: limit, getPattern: getPattern, order: order, sorting: sorting, destination: destination) )
1337
1209
}
1338
1210
1339
1211
/// Returns the sorted elements of a list, a set, or a sorted set.
@@ -1343,14 +1215,7 @@ extension ValkeyConnectionProtocol {
1343
1215
/// - Complexity: O(N+M*log(M)) where N is the number of elements in the list or set to sort, and M the number of returned elements. When the elements are not sorted, complexity is O(N).
1344
1216
/// - Returns: [Array]: A list of sorted elements.
1345
1217
@inlinable
1346
- public func sortRo(
1347
- key: ValkeyKey ,
1348
- byPattern: String ? = nil ,
1349
- limit: SORTRO . Limit ? = nil ,
1350
- getPattern: [ String ] = [ ] ,
1351
- order: SORTRO . Order ? = nil ,
1352
- sorting: Bool = false
1353
- ) async throws -> RESPToken . Array {
1218
+ public func sortRo( key: ValkeyKey , byPattern: String ? = nil , limit: SORTRO . Limit ? = nil , getPattern: [ String ] = [ ] , order: SORTRO . Order ? = nil , sorting: Bool = false ) async throws -> RESPToken . Array {
1354
1219
try await send ( command: SORTRO ( key: key, byPattern: byPattern, limit: limit, getPattern: getPattern, order: order, sorting: sorting) )
1355
1220
}
1356
1221
0 commit comments