databases.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of Hyperf.
  5. *
  6. * @link https://www.hyperf.io
  7. * @document https://hyperf.wiki
  8. * @contact group@hyperf.io
  9. * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  10. */
  11. return [
  12. 'default' => [
  13. 'driver' => env('DB_DRIVER', 'mysql'),
  14. 'host' => env('DB_HOST', 'localhost'),
  15. 'port' => env('DB_PORT', '3306'),
  16. 'database' => env('DB_DATABASE', 'hyperf'),
  17. 'username' => env('DB_USERNAME', 'root'),
  18. 'password' => env('DB_PASSWORD', ''),
  19. 'charset' => env('DB_CHARSET', 'utf8'),
  20. 'collation' => env('DB_COLLATION', 'utf8_unicode_ci'),
  21. 'prefix' => env('DB_PREFIX', ''),
  22. 'pool' => [
  23. 'min_connections' => 1,
  24. 'max_connections' => 10,
  25. 'connect_timeout' => 10.0,
  26. 'wait_timeout' => 3.0,
  27. 'heartbeat' => -1,
  28. 'max_idle_time' => (float) env('DB_MAX_IDLE_TIME', 60),
  29. ],
  30. 'cache' => [
  31. 'handler' => Hyperf\ModelCache\Handler\RedisHandler::class,
  32. 'cache_key' => 'mc:%s:m:%s:%s:%s',
  33. 'prefix' => 'default',
  34. 'ttl' => 3600 * 24,
  35. 'load_script' => true,
  36. ],
  37. 'commands' => [
  38. 'gen:model' => [
  39. 'path' => 'app/Model',
  40. 'force_casts' => true,
  41. 'inheritance' => 'Model',
  42. ],
  43. ],
  44. ],
  45. ];