MySQL 8.0.40
Source Code Documentation
|
connection pool of mysql connections. More...
#include <connection_pool.h>
Public Types | |
using | connection_type = PooledClassicConnection |
Public Member Functions | |
ConnectionPool (uint32_t max_pooled_connections, std::chrono::milliseconds idle_timeout) | |
ConnectionPool (const ConnectionPool &)=delete | |
ConnectionPool & | operator= (const ConnectionPool &)=delete |
ConnectionPool (ConnectionPool &&)=delete | |
ConnectionPool & | operator= (ConnectionPool &&)=delete |
~ConnectionPool ()=default | |
void | add (connection_type conn) |
std::optional< connection_type > | add_if_not_full (connection_type conn) |
add connection to the pool if the poll isn't full. More... | |
template<class UnaryPredicate > | |
std::optional< connection_type > | pop_if (UnaryPredicate pred) |
get a connection from the pool that matches a predicate. More... | |
uint32_t | current_pooled_connections () const |
number of currently pooled connections. More... | |
uint32_t | max_pooled_connections () const |
std::chrono::milliseconds | idle_timeout () const |
uint64_t | reused_connections () const |
total number of reused connections. More... | |
Protected Types | |
using | container_type = std::list< connection_type > |
Protected Member Functions | |
void | erase (container_type::iterator it) |
Protected Attributes | |
const uint32_t | max_pooled_connections_ |
const std::chrono::milliseconds | idle_timeout_ |
Monitor< std::list< connection_type > > | pool_ {{}} |
uint64_t | reused_ {} |
connection pool of mysql connections.
pool can contain connections:
|
protected |
|
inline |
|
delete |
|
delete |
|
default |
void ConnectionPool::add | ( | ConnectionPool::connection_type | conn | ) |
std::optional< ConnectionPool::connection_type > ConnectionPool::add_if_not_full | ( | ConnectionPool::connection_type | conn | ) |
add connection to the pool if the poll isn't full.
uint32_t ConnectionPool::current_pooled_connections | ( | ) | const |
number of currently pooled connections.
|
protected |
|
inline |
|
inline |
|
delete |
|
delete |
|
inline |
get a connection from the pool that matches a predicate.
|
inline |
total number of reused connections.
|
protected |
|
protected |
|
protected |
|
protected |