A simple connection pool. Runs open connections in two data structures: a queue of free connections and a map of busy connections. The connections are taken from a tail of the queue and put back into the head.
Every time the connection is borrowed, it's check for expiration. An expired connection gets closed, and the one is produced.
Should all free connections are in use at the moment and the client is going to borrow another one, an exception is triggered.
When a connection is put back, it's checked for expiration and for the transaction status. Connections that are in the error state are closed; Connections that are in a transaction are rolled back.
A simple connection pool. Runs open connections in two data structures: a queue of free connections and a map of busy connections. The connections are taken from a tail of the queue and put back into the head. Every time the connection is borrowed, it's check for expiration. An expired connection gets closed, and the one is produced. Should all free connections are in use at the moment and the client is going to borrow another one, an exception is triggered. When a connection is put back, it's checked for expiration and for the transaction status. Connections that are in the error state are closed; Connections that are in a transaction are rolled back.
(close pool)
Deprecated! Use pg.core/close
.
Deprecated! Use `pg.core/close`.
(closed? pool)
Deprecated! Use pg.core/closed?
Deprecated! Use `pg.core/closed?`
(free-count pool)
Return the current number of free connections.
Return the current number of free connections.
(id pool)
Deprecated! Use pg.core/id
.
Deprecated! Use `pg.core/id`.
(pool & args)
Deprecated! Use pg.core/pool
.
Deprecated! Use `pg.core/pool`.
(pool? x)
Deprecated! Use pg.core/pool?
.
Deprecated! Use `pg.core/pool?`.
(replenish-connections pool)
Forcibly run a task that determines how many new free connections should be created, and creates them. The number is calculated as follows:
gap = min-size - size(free-conns) - size(used-conns)
When gap is > 0, the corresponding number of free connections is created.
Blocks the pool.
Forcibly run a task that determines how many new free connections should be created, and creates them. The number is calculated as follows: gap = min-size - size(free-conns) - size(used-conns) When gap is > 0, the corresponding number of free connections is created. Blocks the pool.
(stats pool)
Return both free and used connection amount as a map.
Return both free and used connection amount as a map.
(used-count pool)
Return the current number of busy connections.
Return the current number of busy connections.
(with-conn & args)
Deprecated! Use pg.core/with-conn
.
Deprecated! Use `pg.core/with-conn`.
(with-connection & args)
Deprecated! Use pg.core/with-connection
.
Deprecated! Use `pg.core/with-connection`.
(with-pool & args)
Deprecated! Use pg.core/with-pool
.
Deprecated! Use `pg.core/with-pool`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close