1
1
import Foundation
2
2
import NIO
3
3
4
- extension NIORedisConnection {
4
+ extension RedisConnection {
5
5
/// Select the Redis logical database having the specified zero-based numeric index.
6
6
/// New connections always use the database 0.
7
7
///
8
8
/// https://redis.io/commands/select
9
9
public func select( _ id: Int ) -> EventLoopFuture < Void > {
10
- return command ( " SELECT " , [ RESPValue ( bulk: id. description) ] )
10
+ return command ( " SELECT " , arguments : [ RESPValue ( bulk: id. description) ] )
11
11
. map { _ in return ( ) }
12
12
}
13
13
14
14
/// Request for authentication in a password-protected Redis server.
15
15
///
16
16
/// https://redis.io/commands/auth
17
17
public func authorize( with password: String ) -> EventLoopFuture < Void > {
18
- return command ( " AUTH " , [ RESPValue ( bulk: password) ] ) . map { _ in return ( ) }
18
+ return command ( " AUTH " , arguments: [ RESPValue ( bulk: password) ] )
19
+ . map { _ in return ( ) }
19
20
}
20
21
21
22
/// Removes the specified keys. A key is ignored if it does not exist.
@@ -24,7 +25,7 @@ extension NIORedisConnection {
24
25
/// - Returns: A future number of keys that were removed.
25
26
public func delete( _ keys: String ... ) -> EventLoopFuture < Int > {
26
27
let keyArgs = keys. map { RESPValue ( bulk: $0) }
27
- return command ( " DEL " , keyArgs)
28
+ return command ( " DEL " , arguments : keyArgs)
28
29
. thenThrowing { res in
29
30
guard let count = res. int else {
30
31
throw RedisError ( identifier: " delete " , reason: " Unexpected response: \( res) " )
@@ -41,7 +42,7 @@ extension NIORedisConnection {
41
42
/// - after: The lifetime (in seconds) the key will expirate at.
42
43
/// - Returns: A future bool indicating if the expiration was set or not.
43
44
public func expire( _ key: String , after deadline: Int ) -> EventLoopFuture < Bool > {
44
- return command ( " EXPIRE " , [ RESPValue ( bulk: key) , RESPValue ( bulk: deadline. description) ] )
45
+ return command ( " EXPIRE " , arguments : [ RESPValue ( bulk: key) , RESPValue ( bulk: deadline. description) ] )
45
46
. thenThrowing { res in
46
47
guard let value = res. int else {
47
48
throw RedisError ( identifier: " expire " , reason: " Unexpected response: \( res) " )
@@ -56,7 +57,7 @@ extension NIORedisConnection {
56
57
///
57
58
/// https://redis.io/commands/get
58
59
public func get( _ key: String ) -> EventLoopFuture < String ? > {
59
- return command ( " GET " , [ RESPValue ( bulk: key) ] )
60
+ return command ( " GET " , arguments : [ RESPValue ( bulk: key) ] )
60
61
. map { return $0. string }
61
62
}
62
63
@@ -66,7 +67,7 @@ extension NIORedisConnection {
66
67
///
67
68
/// https://redis.io/commands/set
68
69
public func set( _ key: String , to value: String ) -> EventLoopFuture < Void > {
69
- return command ( " SET " , [ RESPValue ( bulk: key) , RESPValue ( bulk: value) ] )
70
+ return command ( " SET " , arguments : [ RESPValue ( bulk: key) , RESPValue ( bulk: value) ] )
70
71
. map { _ in return ( ) }
71
72
}
72
73
}
0 commit comments