MySQLi Connection Pool Config

MySQLi Connection Pool Config

  • Swoole\Database\MysqliConfig->withHost
  • Swoole\Database\MysqliConfig->withUnixSocket
  • Swoole\Database\MysqliConfig->withPort
  • Swoole\Database\MysqliConfig->withDbname
  • Swoole\Database\MysqliConfig->withCharset
  • Swoole\Database\MysqliConfig->withUsername
  • Swoole\Database\MysqliConfig->withPassword
  • Swoole\Database\MysqliConfig->withOptions

    Swoole\Database\RedisConfig->withHost(string $host)
    Swoole\Database\RedisConfig->withPort(int $port)
    Swoole\Database\RedisConfig->withTimeout(float $timeout)
    Swoole\Database\RedisConfig->withReserved(string $reserved)
    Swoole\Database\RedisConfig->withRetryInterval(int $retry_interval)
    Swoole\Database\RedisConfig->withReadTimeout(float $read_timeout)
    Swoole\Database\RedisConfig->withAuth(string $auth)
    Swoole\Database\RedisConfig->withDbIndex(int $dbIndex)

    Example

    <?php
    (new MysqliConfig())
        ->withHost(MYSQL_SERVER_HOST)
        ->withPort(MYSQL_SERVER_PORT)
        // ->withUnixSocket('/tmp/mysql.sock')
        ->withDbName(MYSQL_SERVER_DB)
        ->withCharset('utf8mb4')
        ->withUsername(MYSQL_SERVER_USER)
        ->withPassword(MYSQL_SERVER_PWD)