pub struct Builder { /* private fields */ }Expand description
A builder for a RedisPool
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn desired_pool_size(self, v: usize) -> Self
pub fn desired_pool_size(self, v: usize) -> Self
The number of connections a pool should have. If a pool with multiple sub pools is created, this value applies to each sub pool.
The default is 50.
Sourcepub fn default_checkout_mode<T: Into<DefaultPoolCheckoutMode>>(
self,
v: T,
) -> Self
pub fn default_checkout_mode<T: Into<DefaultPoolCheckoutMode>>( self, v: T, ) -> Self
Sets the behaviour of the pool on checkouts if no specific behaviour was requested by the user.
Sourcepub fn backoff_strategy(self, v: BackoffStrategy) -> Self
pub fn backoff_strategy(self, v: BackoffStrategy) -> Self
The BackoffStrategy to use when retrying on
failures to create new connections
Sourcepub fn reservation_limit(self, v: usize) -> Self
pub fn reservation_limit(self, v: usize) -> Self
The maximum length of the queue for waiting checkouts when no idle connections are available. If a pool with multiple sub pools is created, this value applies to each sub pool.
The default is 50.
pub fn activation_order(self, v: ActivationOrder) -> Self
Sourcepub fn min_required_nodes(self, v: usize) -> Self
pub fn min_required_nodes(self, v: usize) -> Self
The minimum required nodes to start
Sourcepub fn connect_to_nodes(self, v: Vec<String>) -> Self
pub fn connect_to_nodes(self, v: Vec<String>) -> Self
The Redis nodes to connect to
Sourcepub fn connect_to_node<T: Into<String>>(self, v: T) -> Self
pub fn connect_to_node<T: Into<String>>(self, v: T) -> Self
The Redis node to connect to
Sourcepub fn pool_multiplier(self, v: u32) -> Self
pub fn pool_multiplier(self, v: u32) -> Self
When the pool is created this is a multiplier for the amount of sub pools to be created.
Other values will be adjusted if the multiplier is > 1:
reservation_limit: Stays zero if zero, otherwise (reservation_limit/multiplier) +1desired_pool_size:desired_pool_size/multiplier) +1
Sourcepub fn checkout_queue_size(self, v: usize) -> Self
pub fn checkout_queue_size(self, v: usize) -> Self
The number of checkouts that can be enqueued. If a pool with multiple sub pools is created, this value applies to each sub pool.
The default is 100.
Sourcepub fn retry_on_checkout_limit(self, v: bool) -> Self
pub fn retry_on_checkout_limit(self, v: bool) -> Self
Set to true if a retry on a checkout should be made if the queue was full.
Otherwise do not retry.
The default is true.
Sourcepub fn default_command_timeout<T: Into<DefaultCommandTimeout>>(
self,
v: T,
) -> Self
pub fn default_command_timeout<T: Into<DefaultCommandTimeout>>( self, v: T, ) -> Self
A timeout for commands which is applied to all commands on all connections.
Sourcepub fn task_executor(self, handle: Handle) -> Self
pub fn task_executor(self, handle: Handle) -> Self
The executor to use for spawning tasks. If not set it is assumed that the pool is created on the default runtime.
Sourcepub fn instrumented<I>(self, instrumentation: I) -> Self
pub fn instrumented<I>(self, instrumentation: I) -> Self
Adds instrumentation to the pool
Sourcepub fn update_from_environment(
&mut self,
prefix: Option<&str>,
) -> InitializationResult<()>
pub fn update_from_environment( &mut self, prefix: Option<&str>, ) -> InitializationResult<()>
Sets values in this builder from the environment.
If no prefix is set all the given env key start with REOOL_.
Otherwise the prefix is used with an automatically appended _.
DESIRED_POOL_SIZE:usize. Omit if you do not want to update the valueDEFAULT_POOL_CHECKOUT_MODE: The default checkout mode to use. Omit if you do not want to update the valueRESERVATION_LIMIT:usize. Omit if you do not want to update the valueACTIVATION_ORDER:string. Omit if you do not want to update the valueMIN_REQUIRED_NODES:usize. Omit if you do not want to update the valueCONNECT_TO:[String]. Separated by;. Omit if you do not want to update the valuePOOL_MULTIPLIER: Omit if you do not want to update the valueCHECKOUT_QUEUE_SIZE: Omit if you do not want to update the valueRETRY_ON_CHECKOUT_LIMIT: Omit if you do not want to update the valueDEFAULT_COMMAND_TIMEOUT_MS: Omit if you do not want to update the value
Sourcepub fn updated_from_environment(
self,
prefix: Option<&str>,
) -> InitializationResult<Self>
pub fn updated_from_environment( self, prefix: Option<&str>, ) -> InitializationResult<Self>
Updates this builder from the environment and returns Self.
If no prefix is set all the given env key start with REOOL_.
Otherwise the prefix is used with an automatically appended _.
DESIRED_POOL_SIZE:usize. Omit if you do not want to update the valueDEFAULT_POOL_CHECKOUT_MODE: The default checkout mode to use. Omit if you do not want to update the valueRESERVATION_LIMIT:usize. Omit if you do not want to update the valueACTIVATION_ORDER:string. Omit if you do not want to update the valueMIN_REQUIRED_NODES:usize. Omit if you do not want to update the valueCONNECT_TO:[String]. Separated by;. Omit if you do not want to update the valuePOOL_MULTIPLIER: Omit if you do not want to update the valueCHECKOUT_QUEUE_SIZE: Omit if you do not want to update the valueRETRY_ON_CHECKOUT_LIMIT: Omit if you do not want to update the valueDEFAULT_COMMAND_TIMEOUT_MS: Omit if you do not want to update the value
Sourcepub fn finish<CF, F>(
self,
connection_factory: F,
) -> InitializationResult<RedisPool<CF::Connection>>
pub fn finish<CF, F>( self, connection_factory: F, ) -> InitializationResult<RedisPool<CF::Connection>>
Build a new RedisPool with the given connection factory
Sourcepub fn finish_redis_rs(self) -> InitializationResult<RedisPool>
pub fn finish_redis_rs(self) -> InitializationResult<RedisPool>
Build a new RedisPool