You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/RediStack/RedisConnection.swift
+40-42Lines changed: 40 additions & 42 deletions
Original file line number
Diff line number
Diff line change
@@ -20,71 +20,71 @@ import NIO
20
20
import NIOConcurrencyHelpers
21
21
22
22
extensionRedisConnection{
23
-
/// The documented default port that Redis connects through.
24
-
///
25
-
/// See [https://redis.io/topics/quickstart](https://redis.io/topics/quickstart)
26
-
publicstaticletdefaultPort=6379
27
23
28
-
/// Creates a new connection to a Redis instance.
24
+
/// Creates a new connection with provided configuration and sychronization objects.
29
25
///
30
-
/// If you would like to specialize the `NIO.ClientBootstrap` that the connection communicates on, override the default by passing it in as `tcpClient`.
26
+
/// If you would like to specialize the `NIO.ClientBootstrap` that the connection communicates on, override the default by passing it in as `configuredTCPClient`.
31
27
///
32
28
/// let eventLoopGroup: EventLoopGroup = ...
33
29
/// var customTCPClient = ClientBootstrap.makeRedisTCPClient(group: eventLoopGroup)
34
30
/// customTCPClient.channelInitializer { channel in
35
31
/// // channel customizations
36
32
/// }
37
-
/// let connection = RedisConnection.connect(
38
-
/// to: ...,
39
-
/// on: eventLoopGroup.next(),
40
-
/// password: ...,
41
-
/// tcpClient: customTCPClient
33
+
/// let connection = RedisConnection.make(
34
+
/// configuration: ...,
35
+
/// boundEventLoop: eventLoopGroup.next(),
36
+
/// configuredTCPClient: customTCPClient
42
37
/// ).wait()
43
38
///
44
39
/// It is recommended that you be familiar with `ClientBootstrap.makeRedisTCPClient(group:)` and `NIO.ClientBootstrap` in general before doing so.
45
40
///
46
41
/// Note: Use of `wait()` in the example is for simplicity. Never call `wait()` on an event loop.
47
42
///
48
43
/// - Important: Call `close()` on the connection before letting the instance deinit to properly cleanup resources.
49
-
/// - Note: If a `password` is provided, the connection will send an "AUTH" command to Redis as soon as it has been opened.
50
-
///
44
+
/// - Invariant: If a `password` is provided in the configuration, the connection will send an "AUTH" command to Redis as soon as it has been opened.
45
+
/// - Invariant: If a `database` index is provided in the configuration, the connection will send a "SELECT" command to Redis after it has been authenticated.
51
46
/// - Parameters:
52
-
/// - socket: The `NIO.SocketAddress` information of the Redis instance to connect to.
53
-
/// - eventLoop: The `NIO.EventLoop` that this connection will execute all tasks on.
54
-
/// - password: The optional password to use for authorizing the connection with Redis.
55
-
/// - logger: The `Logging.Logger` instance to use for all client logging purposes. If one is not provided, one will be created.
56
-
/// A `Foundation.UUID` will be attached to the metadata to uniquely identify this connection instance's logs.
57
-
/// - tcpClient: If you have chosen to configure a `NIO.ClientBootstrap` yourself, this will be used instead of the `makeRedisTCPClient` instance.
58
-
/// - Returns: A `NIO.EventLoopFuture` that resolves with the new connection after it has been opened, and if a `password` is provided, authenticated.
59
-
publicstaticfunc connect(
60
-
to socket:SocketAddress,
61
-
on eventLoop:EventLoop,
62
-
password:String?=nil,
63
-
logger:Logger=.redisBaseConnectionLogger,
64
-
tcpClient:ClientBootstrap?=nil
47
+
/// - config: The configuration to use for creating the connection.
48
+
/// - eventLoop: The `NIO.EventLoop` that the connection will be bound to.
49
+
/// - client: If you have chosen to configure a `NIO.ClientBootstrap` yourself, this will be used instead of the `.makeRedisTCPClient` factory instance.
50
+
/// - Returns: A `NIO.EventLoopFuture` that resolves with the new connection after it has been opened, configured, and authenticated per the `configuration` object.
0 commit comments