helper.php 490 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4. * 容器实例
  5. */
  6. use Hyperf\Utils\ApplicationContext;
  7. if (! function_exists('container')) {
  8. function container()
  9. {
  10. return ApplicationContext::getContainer();
  11. }
  12. }
  13. if (! function_exists('redis_pool')) {
  14. /**
  15. * redis 客户端连接池.
  16. * @param mixed $config
  17. * @return Redis
  18. */
  19. function redis_pool($config)
  20. {
  21. return container()->get(\Hyperf\Redis\RedisFactory::class)->get($config);
  22. }
  23. }