Pool-class | R Documentation |
A generic pool class that holds objects. These can be fetched from the pool and released back to it at will, with very little computational cost. The pool should be created only once and closed when it is no longer needed, to prevent leaks.
Every usage of poolCreate()
should always be paired with a call to
poolClose()
to avoid "leaking" resources. In shiny app, you should
create the pool outside of the server function and close it on stop,
i.e. onStop(function() pool::poolClose(pool))
.
See dbPool()
for an example of object pooling applied to DBI database
connections.
poolCreate(
factory,
minSize = 1,
maxSize = Inf,
idleTimeout = 60,
validationInterval = 60,
state = NULL
)
poolClose(pool)
## S4 method for signature 'Pool'
poolClose(pool)
factory |
A zero-argument function called to create the objects that
the pool will hold (e.g. for DBI database connections, |
minSize , maxSize |
The minimum and maximum number of objects in the pool. |
idleTimeout |
Number of seconds to wait before destroying idle objects
(i.e. objects available for checkout over and above |
validationInterval |
Number of seconds to wait between validating objects that are available for checkout. These objects are validated in the background to keep them alive. To force objects to be validated on every checkout, set
|
state |
A |
pool |
A Pool object previously created with |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.