#include <icy/http/server.h>LIFO connection pool for reusing ServerConnection objects. Avoids per-request heap allocation by resetting and reusing connections instead of destroying and recreating them.
| Return | Name | Description |
|---|---|---|
ServerConnection::Ptr | acquire inline | Takes a connection from the pool for reuse. |
bool | release inline | Returns a connection to the pool after use. |
void | setMaxSize inline | Sets the maximum number of connections the pool will hold. |
size_t | size const inline | Returns the current number of connections held in the pool. |
inline
inline ServerConnection::Ptr acquire()Takes a connection from the pool for reuse.
A pooled connection, or nullptr if the pool is empty.
inline
inline bool release(ServerConnection::Ptr & conn)Returns a connection to the pool after use.
conn The connection to return.true if accepted into the pool; false if the pool is full.
inline
inline void setMaxSize(size_t n)Sets the maximum number of connections the pool will hold.
n Maximum pool capacity.const inline
inline size_t size() constReturns the current number of connections held in the pool.
std::vector< ServerConnection::Ptr > _poolsize_t _maxSize = 128