123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- declare(strict_types=1);
- namespace App\Service;
- use App\Master\Enum\PassportEnum;
- use Hyperf\Di\Annotation\Inject;
- use Hyperf\Cache\Listener\DeleteListenerEvent;
- use Psr\EventDispatcher\EventDispatcherInterface;
- /**
- * Author:Panda
- * Email:joeyoung0314@qq.com
- * Class SystemService
- * @package App\Service
- */
- class SystemService
- {
- #[Inject]
- protected EventDispatcherInterface $dispatcher;
- /**
- * 清除用户信息缓存
- *
- * @param int $user_id
- * @return bool
- */
- public function flushCache(int $user_id): bool
- {
- $this->dispatcher->dispatch(new DeleteListenerEvent(PassportEnum::USER_INFO, ['user_id' => $user_id]));
- return true;
- }
- }
|