/** * @param ShowQuery $query */ public function handle(ShowQuery $query) { $serverConfig = $this->serversConfig->getServerConfig($query->getServerKey()); $connection = new ServerConnection($serverConfig); $manager = new ServerManager($connection); $page = new TwigPage('ServerInfo.twig', ['appConfig' => $this->appConfig, 'server' => $serverConfig, 'database' => '0', 'serverKey' => $query->getServerKey(), 'databaseMap' => $serverConfig->getDatabaseMap(), 'serverConfig' => $manager->getServerConfig(), 'slowLogLength' => $manager->getSlowLogLength(), 'slowLogs' => $manager->getSlowLogs(), 'serverInfo' => $manager->getServerInfo(), 'manager' => $manager]); $page->respond(); }
/** * @param SearchKeysQuery $query */ public function handle(SearchKeysQuery $query) { $serverConfig = $this->serversConfig->getServerConfig($query->getServerKey()); $connection = new ServerConnection($serverConfig); $manager = new ServerManager($connection); $limit = $this->getValidLimit($query->getLimit()); $searchPattern = $query->getSearchPattern() ?: '*'; $manager->selectDatabase($query->getDatabase()); $keyInfoObjects = $manager->getKeyInfoObjects($searchPattern, $limit); $page = new TwigPage('Includes/KeyList.twig', ['appConfig' => $this->appConfig, 'keyInfoObjects' => $keyInfoObjects, 'database' => $query->getDatabase(), 'serverKey' => $query->getServerKey()]); $page->respond(); }
/** * @param ShowKeyQuery $query * * @throws \hollodotme\Readis\Exceptions\ServerConfigNotFound */ public function handle(ShowKeyQuery $query) { $serverKey = $query->getServerKey(); $key = $query->getKey(); $hashKey = $query->getHashKey(); $database = $query->getDatabase(); $serverConfig = $this->serversConfig->getServerConfig($serverKey); $connection = new ServerConnection($serverConfig); $manager = new ServerManager($connection); $manager->selectDatabase($database); if (empty($hashKey)) { $keyData = $manager->getValueAsUnserializedString($key, new NullUnserializer()); } else { $keyData = $manager->getHashValueAsUnserializedString($key, $hashKey, new NullUnserializer()); } $keyInfo = $manager->getKeyInfoObject($key); $page = new TwigPage('Includes/KeyData.twig', ['appConfig' => $this->appConfig, 'keyData' => $keyData, 'keyInfo' => $keyInfo, 'database' => $database, 'serverKey' => $serverKey, 'hashKey' => $hashKey]); $page->respond(); }