<?php
declare(strict_types=1);
namespace App\System\Controller\Monitor;
use App\System\Service\CacheMonitorService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\DeleteMapping;
use Hyperf\HttpServer\Annotation\GetMapping;
use Hyperf\HttpServer\Annotation\PostMapping;
use Mine\Annotation\Auth;
use Mine\Annotation\OperationLog;
use Mine\Annotation\Permission;
use Mine\MineController;
use Psr\Http\Message\ResponseInterface;
class CacheMonitorController extends MineController
{
protected $service;
public function getCacheInfo(): ResponseInterface
{
return $this->success($this->service->getCacheServerInfo());
}
public function view(): ResponseInterface
{
return $this->success(['content' => $this->service->view($this->request->input('key'))]);
}
public function delete(): ResponseInterface
{
return $this->service->delete($this->request->input('key', null))
? $this->success()
: $this->error();
}
public function clear(): ResponseInterface
{
return $this->service->clear() ? $this->success() : $this->error();
}
}