databases.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. 'database' => env('DB_DATABASE', 'hyperf'),
  16. 'username' => env('DB_USERNAME', 'root'),
  17. 'password' => env('DB_PASSWORD', ''),
  18. 'charset' => env('DB_CHARSET', 'utf8'),
  19. 'collation' => env('DB_COLLATION', 'utf8_unicode_ci'),
  20. 'prefix' => env('DB_PREFIX', ''),
  21. 'pool' => [
  22. 'min_connections' => 1,
  23. 'max_connections' => 10,
  24. 'connect_timeout' => 10.0,
  25. 'wait_timeout' => 3.0,
  26. 'heartbeat' => -1,
  27. 'max_idle_time' => (float) env('DB_MAX_IDLE_TIME', 60),
  28. ],
  29. 'cache' => [
  30. 'handler' => \Hyperf\ModelCache\Handler\RedisHandler::class,
  31. 'cache_key' => 'mc:%s:m:%s:%s:%s',
  32. 'prefix' => 'default',
  33. 'pool' => 'default',
  34. 'ttl' => 3600 * 24,
  35. 'empty_model_ttl' => 3600,
  36. 'load_script' => true,
  37. 'use_default_value' => false,
  38. ],
  39. ],
  40. ];