| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace App\Command\Init;
- use Carbon\Carbon;
- use Hyperf\Command\Command as HyperfCommand;
- use App\Repositories\Utils\M3u8CacheRepository;
- use Psr\Container\ContainerInterface;
- class M3u8ClearServersCommand extends HyperfCommand
- {
- /**
- * 执行的命令行
- *
- * @var string
- */
- protected $name = 'init:m3u8_clear_servers';
- /**
- * @var ContainerInterface
- */
- protected $container;
- public function __construct(ContainerInterface $container)
- {
- $this->container = $container;
- parent::__construct($this->name);
- }
- public function configure()
- {
- parent::configure();
- $this->setDescription('清理服务器组缓存.');
- $this->addUsage(" 无参数");
- }
- public function handle()
- {
- $nowDate = Carbon::now()->toDateTimeString();
- M3u8CacheRepository::clearServersCache();
- $this->comment(sprintf('[%s]清理服务器组缓存成功', $nowDate));
- }
- }
|