ConnectionPoolInterface.php 662 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Smf\ConnectionPool;
  3. interface ConnectionPoolInterface
  4. {
  5. /**
  6. * Initialize the connection pool
  7. * @return bool
  8. */
  9. public function init(): bool;
  10. /**
  11. * Return a connection to the connection pool
  12. * @param mixed $connection
  13. * @return bool
  14. */
  15. public function return($connection): bool;
  16. /**
  17. * Borrow a connection to the connection pool
  18. * @return mixed
  19. * @throws BorrowConnectionTimeoutException
  20. */
  21. public function borrow();
  22. /**
  23. * Close the connection pool, release the resource of all connections
  24. * @return bool
  25. */
  26. public function close(): bool;
  27. }