Use poolCheckout()
to check out an object from the pool and
poolReturn()
to return it. You will receive a warning if all objects
aren't returned before the pool is closed.
localCheckout()
is a convenience function that can be used inside
functions (and other function-scoped operations like shiny::reactive()
and local()
). It checks out an object and automatically returns it when
the function exits
Note that validation is only performed when the object is checked out,
so you generally want to keep the checked out around for as little time as
possible.
When pooling DBI database connections, you normally would not use
poolCheckout()
. Instead, for single-shot queries, treat the pool object
itself as the DBI connection object and it will perform checkout/return for
you. And for transactions, use poolWithTransaction()
. See dbPool()
for
an example.