Configuration
public struct Configuration
A configuration object for connection pools.
Warning
This type has reference semantics due toConnectionFactoryConfiguration
.
-
The set of Redis servers to which this pool is initially willing to connect.
Declaration
Swift
public let initialConnectionAddresses: [SocketAddress]
-
The minimum number of connections to preserve in the pool.
If the pool is mostly idle and the Redis servers close these idle connections, the
RedisConnectionPool
will initiate new outbound connections proactively to avoid the number of available connections dropping below this number.Declaration
Swift
public let minimumConnectionCount: Int
-
The maximum number of connections to for this pool, either to be preserved or as a hard limit.
Declaration
Swift
public let maximumConnectionCount: RedisConnectionPoolSize
-
The configuration object that controls the connection retry behavior.
Declaration
Swift
public let connectionRetryConfiguration: (backoff: (initialDelay: TimeAmount, factor: Float32), timeout: TimeAmount)
-
Undocumented
Declaration
Swift
public internal(set) var factoryConfiguration: ConnectionFactoryConfiguration { get }
-
The logger prototype that will be used by the connection pool by default when generating logs.
Declaration
Swift
public internal(set) var poolDefaultLogger: Logger { get }
-
init(initialServerConnectionAddresses:maximumConnectionCount:connectionFactoryConfiguration:minimumConnectionCount:connectionBackoffFactor:initialConnectionBackoffDelay:connectionRetryTimeout:poolDefaultLogger:)
Creates a new connection configuration with the provided options.
Declaration
Swift
public init( initialServerConnectionAddresses: [SocketAddress], maximumConnectionCount: RedisConnectionPoolSize, connectionFactoryConfiguration: ConnectionFactoryConfiguration, minimumConnectionCount: Int = 1, connectionBackoffFactor: Float32 = 2, initialConnectionBackoffDelay: TimeAmount = .milliseconds(100), connectionRetryTimeout: TimeAmount? = .seconds(60), poolDefaultLogger: Logger? = nil )
Parameters
initialServerConnectionAddresses
The set of Redis servers to which this pool is initially willing to connect. This set can be updated over time directly on the connection pool.
maximumConnectionCount
The maximum number of connections to for this pool, either to be preserved or as a hard limit.
connectionFactoryConfiguration
The configuration to use while creating connections to fill the pool.
minimumConnectionCount
The minimum number of connections to preserve in the pool. If the pool is mostly idle and the Redis servers close these idle connections, the
RedisConnectionPool
will initiate new outbound connections proactively to avoid the number of available connections dropping below this number. Defaults to1
.connectionBackoffFactor
Used when connection attempts fail to control the exponential backoff. This is a multiplicative factor, each connection attempt will be delayed by this amount times the previous delay.
initialConnectionBackoffDelay
If a TCP connection attempt fails, this is the first backoff value on the reconnection attempt. Subsequent backoffs are computed by compounding this value by
connectionBackoffFactor
.connectionRetryTimeout
The max time to wait for a connection to be available before failing a particular command or connection operation. The default is 60 seconds.
poolDefaultLogger
The
Logger
used by the connection pool itself.