Streamable multibulk responses are not globally supported by the
abstractions built-in into Predis, such as transactions or pipelines.
Use them with care!
public useIterableMultibulk ( boolean $value ) | ||
$value | boolean | Enable or disable streamable multibulk responses. |
/** * @group disconnected */ public function testIterableMultibulkSupport() { $protocol = new ProtocolProcessor(); $protocol->useIterableMultibulk(true); $connection = $this->getMock('Predis\\Connection\\CompositeConnectionInterface'); $connection->expects($this->once(4))->method('readLine')->will($this->returnValue('*1')); $this->assertInstanceOf('Predis\\Response\\Iterator\\MultiBulk', $protocol->read($connection)); }
/** * Returns a new client instance. * * @return Client */ protected function getClient() { $parameters = $this->getParameters(array('read_write_timeout' => 2)); $protocol = new TextProtocolProcessor(); $protocol->useIterableMultibulk(true); $connection = new CompositeStreamConnection($parameters, $protocol); $client = new Client($connection); $client->connect(); $client->flushdb(); return $client; }