redis.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. use function Hyperf\Support\env;
  12. return [
  13. 'default' => [
  14. 'host' => env('REDIS_HOST', 'localhost'),
  15. 'auth' => env('REDIS_AUTH', null),
  16. 'port' => (int) env('REDIS_PORT', 6379),
  17. 'db' => (int) env('REDIS_DB', 0),
  18. 'timeout' => 0.0,
  19. 'reserved' => null,
  20. 'retry_interval' => 0,
  21. 'read_timeout' => 0.0,
  22. 'cluster' => [
  23. 'enable' => (bool) env('REDIS_CLUSTER_ENABLE', false),
  24. 'name' => null,
  25. 'seeds' => [],
  26. ],
  27. 'sentinel' => [
  28. 'enable' => (bool) env('REDIS_SENTINEL_ENABLE', false),
  29. 'master_name' => env('REDIS_MASTER_NAME', 'mymaster'),
  30. 'nodes' => explode(';', env('REDIS_SENTINEL_NODE', '')),
  31. 'persistent' => '',
  32. 'read_timeout' => 0,
  33. 'auth' => env('REDIS_SENTINEL_PASSWORD', ''),
  34. ],
  35. 'pool' => [
  36. 'min_connections' => 1,
  37. 'max_connections' => 10,
  38. 'connect_timeout' => 10.0,
  39. 'wait_timeout' => 3.0,
  40. 'heartbeat' => -1,
  41. 'max_idle_time' => (float) env('REDIS_MAX_IDLE_TIME', 60),
  42. ],
  43. 'options' => [
  44. 'prefix' => env('REDIS_PREFIX', ''),
  45. ],
  46. ],
  47. ];