Lwt pool : _
val Lwt_unix.pool_size : unit -> int
Maximum number of system threads that can be started. If this limit is reached, jobs will be executed synchronously.
val Lwt_pool.clear : 'a t -> unit Lwt.t
clear p
will clear all elements in p
, calling the dispose
function associated with p
on each of the cleared elements. Any elements from p
which are currently in use will be disposed of once they are released.
val Lwt_unix.set_pool_size : int -> unit
Change the size of the pool.
val Lwt_pool.wait_queue_length : _ t -> int
wait_queue_length p
returns the number of use
requests currently waiting for an element of the pool p
to become available.
val Lwt_pool.use : 'a t -> ('a -> 'b Lwt.t) -> 'b Lwt.t
use p f
requests one free element of the pool p
and gives it to the function f
. The element is put back into the pool after the promise created by f
completes.
val Lwt_pool.create : int -> ?validate:('a -> bool Lwt.t) -> ?check:('a -> (bool -> unit) -> unit) -> ?dispose:('a -> unit Lwt.t) -> (unit -> 'a Lwt.t) -> 'a t
create n ?check ?validate ?dispose f
creates a new pool with at most n
elements. f
is used to create a new pool element. Elements are created on demand and re-used until disposed of.
val Caqti_lwt.Pool.size : ('a, 'e) t -> int
size pool
is the current number of open resources in pool
.
val Caqti_lwt.Pool.drain : ('a, 'e) t -> unit Lwt.t
drain pool
closes all resources in pool
. The pool is still usable, as new resources will be created on demand.
val Core_lwt_pool.use : 'a t -> f:('a -> 'b Lwt.t) -> 'b Lwt.t
use p ~f
takes one free member of the pool p
and gives it to the function f
.
val Caqti_lwt.Pool.use : ?priority:float -> ('a -> ('b, 'e) result Lwt.t) -> ('a, 'e) t -> ('b, 'e) result Lwt.t
use f pool
calls f
on a resource drawn from pool
, handing back the resource to the pool when f
exits.
val Core_lwt_pool.create : int -> ?validate:('a -> bool Lwt.t) -> ?check:('a -> (bool -> unit) -> unit) -> ?dispose:('a -> unit Lwt.t) -> (unit -> 'a Lwt.t) -> 'a t
create n ?check ?validate f
creates a new pool with at most n
members. f
is the function to use to create a new pool member.
val Caqti_lwt.Pool.create : ?max_size:int -> ?max_idle_size:int -> ?check:('a -> (bool -> unit) -> unit) -> ?validate:('a -> bool Lwt.t) -> ?log_src:Logs.Src.t -> (unit -> ('a, 'e) result Lwt.t) -> ('a -> unit Lwt.t) -> ('a, 'e) t
Internal: create alloc free
is a pool of resources allocated by alloc
and freed by free
. This is primarily intended for implementing the connect_pool
functions.
val Caqti_lwt.connect_pool : ?max_size:int -> ?max_idle_size:int -> ?post_connect:(connection -> (unit, 'connect_error) result Lwt.t) -> ?env:(Caqti_driver_info.t -> string -> Caqti_query.t) -> ?tweaks_version:(int * int) -> Uri.t -> ((connection, !!todo!!) Pool.t, !!todo!!) result
connect_pool uri
is a pool of database connections constructed by connect uri
.
val Session_redis_lwt.of_connection_pool : Redis_lwt.Client.connection Lwt_pool.t -> t