pub enum ConnectionStrategy {
Pooled {
size: NonZeroU8,
},
Multiplexed {
connections: NonZeroU8,
},
}Expand description
Selects how a client manages its underlying Redis connection(s).
The asynchronous client defaults to ConnectionStrategy::Multiplexed, which
pipelines many concurrent in-flight commands over a small number of shared,
auto-reconnecting sockets. The synchronous client always uses
ConnectionStrategy::Pooled (a blocking connection cannot be multiplexed).
§Example
use std::num::NonZeroU8;
use falkordb::ConnectionStrategy;
// One shared multiplexed socket carrying many concurrent commands.
let strategy = ConnectionStrategy::Multiplexed {
connections: NonZeroU8::new(1).unwrap(),
};
assert_eq!(strategy.connection_count().get(), 1);Variants§
Pooled
A fixed pool of independent connections, each used by exactly one command at a time (borrow/return). Provides strict per-command isolation and a natural cap on the number of in-flight commands. This is the only strategy for the sync client.
Multiplexed
A small number of shared, cloneable, auto-reconnecting connections. Commands are distributed round-robin across them and pipelined concurrently over each socket, so a single connection can carry many in-flight commands at once. Default for the asynchronous client.
Implementations§
Source§impl ConnectionStrategy
impl ConnectionStrategy
Sourcepub fn connection_count(&self) -> NonZeroU8
pub fn connection_count(&self) -> NonZeroU8
The number of underlying connections this strategy maintains (pool size or number of multiplexed sockets).
Trait Implementations§
Source§impl Clone for ConnectionStrategy
impl Clone for ConnectionStrategy
Source§fn clone(&self) -> ConnectionStrategy
fn clone(&self) -> ConnectionStrategy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ConnectionStrategy
Source§impl Debug for ConnectionStrategy
impl Debug for ConnectionStrategy
impl Eq for ConnectionStrategy
Source§impl PartialEq for ConnectionStrategy
impl PartialEq for ConnectionStrategy
Source§fn eq(&self, other: &ConnectionStrategy) -> bool
fn eq(&self, other: &ConnectionStrategy) -> bool
self and other values to be equal, and is used by ==.