/** * Handles -ERR responses returned by Redis. * * @param ConnectionInterface $connection The connection that returned the error. * @param ResponseErrorInterface $response The error response instance. */ protected function onResponseError(ConnectionInterface $connection, ResponseErrorInterface $response) { // Force disconnection to prevent protocol desynchronization. $connection->disconnect(); $message = $response->getMessage(); throw new ServerException($message); }
/** * {@inheritdoc} */ protected function executePipeline(ConnectionInterface $connection, SplQueue $commands) { while (!$commands->isEmpty()) { $connection->writeRequest($commands->dequeue()); } $connection->disconnect(); return array(); }
/** * Closes the underlying connection and disconnects from the server. */ public function disconnect() { $this->connection->disconnect(); }
/** * Throws an exception on -ERR responses returned by Redis. * * @param ConnectionInterface $connection Redis connection that returned the error. * @param ErrorResponseInterface $response Instance of the error response. * * @throws ServerException */ protected function exception(ConnectionInterface $connection, ErrorResponseInterface $response) { $connection->disconnect(); $message = $response->getMessage(); throw new ServerException($message); }