mirror of
https://github.com/predis/predis.git
synced 2026-10-13 07:18:10 +00:00
Drop support for streamable multibulk responses.
Supporting this feature has been problematic and leaded to some ugly code to make abstractions such as pipelines and transactions aware of these kind of response objects. Furthermore, it was not possible to add them to all the connection classes due to implementation limits. For such reasons Predis do not support them globally anymore, but the actual classes are still shipped within the library so that they can be used to build custom stuff at a level lower than client (that is, unless we decide to remove them for good before going stable).
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
|
||||
namespace Predis\Pipeline;
|
||||
|
||||
use Iterator;
|
||||
use SplQueue;
|
||||
use Predis\ClientException;
|
||||
use Predis\ResponseErrorInterface;
|
||||
@@ -92,38 +91,7 @@ class MultiExecExecutor implements PipelineExecutorInterface
|
||||
throw new ClientException("Invalid number of replies [expected: ".count($commands)." - actual: ".count($responses)."]");
|
||||
}
|
||||
|
||||
$consumer = $responses instanceof Iterator ? 'consumeIteratorResponse' : 'consumeArrayResponse';
|
||||
|
||||
return $this->$consumer($commands, $responses);
|
||||
}
|
||||
|
||||
/**
|
||||
* Consumes an iterator response returned by EXEC.
|
||||
*
|
||||
* @param SplQueue $commands Pipelined commands
|
||||
* @param Iterator $responses Responses returned by EXEC.
|
||||
* @return array
|
||||
*/
|
||||
protected function consumeIteratorResponse(SplQueue $commands, Iterator $responses)
|
||||
{
|
||||
$values = array();
|
||||
|
||||
foreach ($responses as $response) {
|
||||
$command = $commands->dequeue();
|
||||
|
||||
if ($response instanceof ResponseObjectInterface) {
|
||||
if ($response instanceof Iterator) {
|
||||
$response = iterator_to_array($response);
|
||||
$values[] = $command->parseResponse($response);
|
||||
} else {
|
||||
$values[] = $response;
|
||||
}
|
||||
} else {
|
||||
$values[] = $command->parseResponse($response);
|
||||
}
|
||||
}
|
||||
|
||||
return $values;
|
||||
return $this->consumeArrayResponse($commands, $responses);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user