RedisInterface.php 811 B

1234567891011121314151617181920212223242526272829303132333435
  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. namespace App\Service;
  12. use Hyperf\Di\Annotation\Inject;
  13. use Psr\Container\ContainerInterface;
  14. abstract class RedisInterface
  15. {
  16. protected $redis;
  17. #[Inject]
  18. protected ContainerInterface $container;
  19. public function __construct()
  20. {
  21. /**
  22. * 生成图片验证码
  23. * @return string
  24. * @throws \Psr\Container\ContainerExceptionInterface
  25. * @throws \Psr\Container\NotFoundExceptionInterface
  26. * @throws \RedisException
  27. */
  28. $this->redis = $this->container->get(\Hyperf\Redis\Redis::class);
  29. }
  30. }