swoole.php 516 B

123456789101112131415161718
  1. <?php
  2. use Benchmark\Application;
  3. use Cache\Adapter\PHPArray\ArrayCachePool;
  4. use Hamlet\Database\MySQLSwoole\MySQLSwooleDatabase;
  5. use Hamlet\Http\Swoole\Bootstraps\SwooleBootstrap;
  6. require_once __DIR__ . '/vendor/autoload.php';
  7. $database = new MySQLSwooleDatabase(
  8. 'tfb-database',
  9. 'benchmarkdbuser',
  10. 'benchmarkdbpass',
  11. 'hello_world',
  12. intdiv(512, swoole_cpu_num())
  13. );
  14. $application = new Application($database, new ArrayCachePool);
  15. SwooleBootstrap::run('0.0.0.0', 8080, $application, $database);