package caqti
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=ba4dfd5ff94376b5e003f682410b7b3b392c0bbaa0253679fe7671c2e07e895b
sha512=0416807fba620429ee4d64f3a6991238112e0e10dfba9703dced46cf332fd22135a9873007d025441228ce66fb192bf730d4bc776dd2c1a973d7604ab6e789e0
doc/caqti/Caqti_pool_config/index.html
Module Caqti_pool_config
Source
Pool configuration.
Construction and Generic Operations
val create :
?max_size:int ->
?max_idle_size:int ->
?max_idle_age:Mtime.Span.t option ->
?max_use_count:int option ->
unit ->
t
Creates a configuration for the implementation of Caqti_pool_sig.S
. The main arguments populate the configuration with the corresponding settings, which are explaind in Configuration Keys.
The configuration object with no setting, which gives the built-in defaults. Alternatively, use default_from_env
for a configuration based on environment variables.
default_from_env ()
is a configuration constructed from environment variables of the form CAQTI_POOL_<suffix>
, with the upper-cased names of the configuration keys substituted for <suffix>
.
merge_left cL cR
is the configuration cL
with missing settings populated by the corresponding present settings from cR
.
get key config
is the value of key
in config
or None
if unset.
set key value config
is config
with key
set to value
regardless of any previous mapping.
Configuration Keys
The maximum number of open connections associated with the pool. When this limit is hit, an attempt to use the pool will block until a connection becomes available. The value must be at least one. If the selected driver does not support concurrent connections, the value 1
is assumed.
The maximum number of idle connections to put into the pool for reuse. Must be between 0
and max_size
. If you set this, you must also ensure max_size
is set so that the combination is valid. Defaults to max_size
. For drivers which does not support concurrent connections, the value will clipped to a maximum of 1
.
The maximum age of idle connections before they are scheduled to be disconnected and removed from the pool, or None
for no limit. Where possible, a timer will be used to trigger the cleanup. For the caqti.blocking
library, the cleanup will only be done opportunistically when the pool is used.
The maximum number of times a pooled connection is reused, or None
for no limit. The default is currently 100, but may be changed in the future based on real-world experience. The reason this setting was introduced is that we have seen state being retained on the server side.