pub struct PoolConfig {
pub max_connections: usize,
pub min_connections: usize,
pub connection_timeout: Option<Duration>,
pub idle_timeout: Option<Duration>,
pub max_lifetime: Option<Duration>,
pub statement_cache_size: usize,
}Expand description
Configuration for the connection pool.
Fields§
§max_connections: usizeMaximum number of connections in the pool.
min_connections: usizeMinimum number of connections to pre-establish and keep alive.
deadpool exposes no minimum-size knob, so these are established by a best-effort background warmup when the pool is created; the released connections are then retained by the pool.
connection_timeout: Option<Duration>Maximum time to wait for a connection.
idle_timeout: Option<Duration>Timeout for recycling a connection when it is returned to the pool.
Mapped to deadpool’s recycle_timeout, which bounds the recycle check
performed on connection return — it is not an idle-reaping timeout.
deadpool-postgres 0.14 exposes no true idle timeout, so connections are
not closed after a fixed idle period.
max_lifetime: Option<Duration>Maximum lifetime of a connection.
Not yet applied: deadpool-postgres 0.14 exposes no connection lifetime knob, so this value is stored but currently unused.
statement_cache_size: usizeNumber of SQL strings tracked for prepared-statement cache metrics.
PreparedStatementCache records only which SQL strings have been
seen (hit/miss tracing); actual statement caching is per-connection
inside tokio-postgres and is not bounded by this value.
Trait Implementations§
Source§impl Clone for PoolConfig
impl Clone for PoolConfig
Source§fn clone(&self) -> PoolConfig
fn clone(&self) -> PoolConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more