コード例 #1
0
ファイル: predis.php プロジェクト: sohel4r/wordpress_4_1_1
 /**
  * Handles -ERR responses returned by Redis.
  *
  * @param CommandInterface       $command  Redis command that generated the error.
  * @param ErrorResponseInterface $response Instance of the error response.
  *
  * @throws ServerException
  *
  * @return mixed
  */
 protected function onErrorResponse(CommandInterface $command, ErrorResponseInterface $response)
 {
     if ($command instanceof ScriptCommand && $response->getErrorType() === 'NOSCRIPT') {
         $eval = $this->createCommand('EVAL');
         $eval->setRawArguments($command->getEvalArguments());
         $response = $this->executeCommand($eval);
         if (!$response instanceof ResponseInterface) {
             $response = $command->parseResponse($response);
         }
         return $response;
     }
     if ($this->options->exceptions) {
         throw new ServerException($response->getMessage());
     }
     return $response;
 }
コード例 #2
0
ファイル: Client.php プロジェクト: nvanh1984/predis
 /**
  * Handles -ERR responses returned by Redis.
  *
  * @param CommandInterface $command The command that generated the error.
  * @param ResponseErrorInterface $response The error response instance.
  * @return mixed
  */
 protected function onResponseError(CommandInterface $command, ResponseErrorInterface $response)
 {
     if ($command instanceof ScriptedCommand && $response->getErrorType() === 'NOSCRIPT') {
         $eval = $this->createCommand('eval');
         $eval->setRawArguments($command->getEvalArguments());
         return $this->executeCommand($eval);
     }
     if ($this->options->exceptions === true) {
         throw new ServerException($response->getMessage());
     }
     return $response;
 }