mirror of
https://github.com/predis/predis.git
synced 2026-10-14 16:02:50 +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:
@@ -14,8 +14,6 @@ namespace Predis\Connection;
|
||||
use Predis\ResponseError;
|
||||
use Predis\ResponseQueued;
|
||||
use Predis\Command\CommandInterface;
|
||||
use Predis\Iterator\MultiBulkResponseSimple;
|
||||
|
||||
/**
|
||||
* Standard connection to Redis servers implemented on top of PHP's streams.
|
||||
* The connection parameters supported by this class are:
|
||||
@@ -28,24 +26,11 @@ use Predis\Iterator\MultiBulkResponseSimple;
|
||||
* - async_connect: performs the connection asynchronously.
|
||||
* - tcp_nodelay: enables or disables Nagle's algorithm for coalescing.
|
||||
* - persistent: the connection is left intact after a GC collection.
|
||||
* - iterable_multibulk: multibulk replies treated as iterable objects.
|
||||
*
|
||||
* @author Daniele Alessandri <suppakilla@gmail.com>
|
||||
*/
|
||||
class StreamConnection extends AbstractConnection
|
||||
{
|
||||
private $mbiterable;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct(ConnectionParametersInterface $parameters)
|
||||
{
|
||||
$this->mbiterable = (bool) $parameters->iterable_multibulk;
|
||||
|
||||
parent::__construct($parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnects from the server and destroys the underlying resource when
|
||||
* PHP's garbage collector kicks in only if the connection has not been
|
||||
@@ -249,9 +234,6 @@ class StreamConnection extends AbstractConnection
|
||||
if ($count === -1) {
|
||||
return null;
|
||||
}
|
||||
if ($this->mbiterable) {
|
||||
return new MultiBulkResponseSimple($this, $count);
|
||||
}
|
||||
|
||||
$multibulk = array();
|
||||
|
||||
@@ -293,12 +275,4 @@ class StreamConnection extends AbstractConnection
|
||||
|
||||
$this->writeBytes($buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __sleep()
|
||||
{
|
||||
return array_merge(parent::__sleep(), array('mbiterable'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user