Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the anypool Reference Manual, version 0.1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed Jun 15 03:13:45 2022 GMT+0.
Next: Systems, Previous: The anypool Reference Manual, Up: The anypool Reference Manual [Contents][Index]
General-purpose connection pooling library.
This software is still ALPHA quality. The APIs will be likely to change.
(ql:quickload '(:anypool :dbi))
(use-package :anypool)
(defvar *connection-pool*
(make-pool :name "dbi-connections"
:connector (lambda ()
(dbi:connect :postgres
:database-name "webapp"
:username "fukamachi" :password "1ove1isp"))
:disconnector #'dbi:disconnect
:ping #'dbi:ping
:max-open-count 10
:max-idle-count 2))
(fetch *connection-pool*)
;=> #<DBD.POSTGRES:DBD-POSTGRES-CONNECTION {10054E07C3}>
(pool-open-count *connection-pool*)
;=> 1
(pool-idle-count *connection-pool*)
;=> 0
(putback *** *connection-pool*)
; No value
(pool-open-count *connection-pool*)
;=> 1
(pool-idle-count *connection-pool*)
;=> 1
;; Using `with-connection` macro.
(with-connection (mito:*connection* *connection-pool*)
(mito:find-dao 'user :name "fukamachi"))
:name
: The name of a new pool. This is used to print the object.:connector
(Required): A function to make and return a new connection object. It takes no arguments.:disconnector
: A function to disconnect a given object. It takes a single argument which is made by :connector
.:ping
: A function to check if the given object is still available. It takes a single argument.:max-open-count
: The maximum number of concurrently open connections. The default is 4
and can be configured with *default-max-open-count*
.:max-idle-count
: The maximum number of idle/pooled connections. The default is 2
and can be configured with *default-max-idle-count*
.:timeout
: The milliseconds to wait in fetch
when the number of open connection reached to the maximum. If nil
, it waits forever. The default is nil
.:idle-timeout
: The milliseconds to disconnect idle resources after they're putback
ed to the pool. If nil
, it won't disconnect automatically. The default is nil
.Return the maximum number of concurrently open connections. If the number of open connections reached to the limit, fetch
waits until a connection is available.
Set the maximum number of concurrently open connections.
Return the maximum number of idle/pooled connections. If the number of idle connections reached to the limit, extra connections will be disconnected in putback
.
Set the maximum number of idle/pooled connections.
Return the milliseconds to disconnect idle resources after they're putback
ed to the pool. If nil
, this feature is disabled.
Set the milliseconds to disconnect idle resources after they're putback
ed to the pool. If nil
, this feature is disabled.
Return the number of currently open connections. The count is the sum of pool-active-count
and pool-idle-count
.
Return the number of currently in use connections.
Return the number of currently idle connections.
Return an available resource from the pool
. If no open resources available, it makes a new one with a function specified to make-pool
as :connector
.
No open resource available and can't open due to the max-open-count
, this function waits for :timeout
milliseconds. If :timeout
specified to nil
, this waits forever until a new one turns to available.
Send an in-use connection back to pool
to make it reusable by other threads. If the number of idle connections is reached to pool-max-idle-count
, the connection will be disconnected immediately.
Copyright (c) 2020 Eitaro Fukamachi (e.arrows@gmail.com)
Licensed under the BSD 2-Clause License.
Next: Modules, Previous: Introduction, Up: The anypool Reference Manual [Contents][Index]
The main system appears first, followed by any subsystem dependency.
Next: Files, Previous: Systems, Up: The anypool Reference Manual [Contents][Index]
Modules are listed depth-first from the system components tree.
Next: Packages, Previous: Modules, Up: The anypool Reference Manual [Contents][Index]
Files are sorted by type and then listed depth-first from the systems components trees.
Next: anypool/src/main.lisp, Previous: Lisp, Up: Lisp [Contents][Index]
anypool (system).
Previous: anypool/anypool.asd, Up: Lisp [Contents][Index]
src (module).
Next: Definitions, Previous: Files, Up: The anypool Reference Manual [Contents][Index]
Packages are listed by definition order.
anypool/main
common-lisp.
Next: Indexes, Previous: Packages, Up: The anypool Reference Manual [Contents][Index]
Definitions are sorted by export status, category, package, and then by lexicographic order.
Next: Internals, Previous: Definitions, Up: Definitions [Contents][Index]
Next: Macros, Previous: Public Interface, Up: Public Interface [Contents][Index]
Next: Ordinary functions, Previous: Special variables, Up: Public Interface [Contents][Index]
Next: Generic functions, Previous: Macros, Up: Public Interface [Contents][Index]
Next: Standalone methods, Previous: Ordinary functions, Up: Public Interface [Contents][Index]
Next: Conditions, Previous: Generic functions, Up: Public Interface [Contents][Index]
Next: Structures, Previous: Standalone methods, Up: Public Interface [Contents][Index]
:limit
This slot is read-only.
Previous: Conditions, Up: Public Interface [Contents][Index]
structure-object.
fixnum
0
fixnum
0
(bordeaux-threads:make-lock "anypool-lock")
(bordeaux-threads:make-lock "anypool-openwait-lock")
(bordeaux-threads:make-condition-variable :name "anypool-openwait")
Previous: Public Interface, Up: Definitions [Contents][Index]
Next: Conditions, Previous: Internals, Up: Internals [Contents][Index]
Next: Structures, Previous: Ordinary functions, Up: Internals [Contents][Index]
error.
Previous: Definitions, Up: The anypool Reference Manual [Contents][Index]
Jump to: | (
C D E F G I M P Q W |
---|
Jump to: | (
C D E F G I M P Q W |
---|
Next: Data types, Previous: Functions, Up: Indexes [Contents][Index]
Jump to: | *
A C D I L M N O P S T W |
---|
Jump to: | *
A C D I L M N O P S T W |
---|
Jump to: | A C F I M P S T |
---|
Jump to: | A C F I M P S T |
---|