本文整理汇总了PHP中Predis\Client::executeRaw方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::executeRaw方法的具体用法?PHP Client::executeRaw怎么用?PHP Client::executeRaw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Predis\Client
的用法示例。
在下文中一共展示了Client::executeRaw方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @inheritdoc
*/
public function execute(CommandInterface $command)
{
if (!$this->isConnected()) {
throw new ConnectionException('No connection established');
}
return $this->client->executeRaw(array_merge([$command->getCommand()], $command->getArguments()));
}
示例2: getAll
/**
* @inheritDoc
*/
public function getAll() : array
{
if (!$this->client->exists($this->key)) {
$models = $this->repository->getAll();
if ($models) {
$this->client->hmset($this->key, $this->repository->getAllIndexed());
}
} else {
$models = [];
$data = $this->client->executeRaw(['HGETALL', $this->key]);
for ($i = 0; $i < count($data); ++$i) {
/** @var DirectoryView $viewClass */
$viewClass = $this->viewClass;
$models[] = $viewClass::create($data[$i], $data[++$i]);
}
}
return $models;
}
示例3: testRawCommandNeverThrowsExceptions
/**
* @group disconnected
*/
public function testRawCommandNeverThrowsExceptions()
{
$message = 'ERR Mock error response';
$response = new Response\Error($message);
$connection = $this->getMock('Predis\\Connection\\ConnectionInterface');
$connection->expects($this->once())->method('executeCommand')->with($this->isRedisCommand('PING'))->will($this->returnValue($response));
$client = new Client($connection, array('exceptions' => true));
$this->assertSame($message, $client->executeRaw(array('PING'), $error));
$this->assertTrue($error);
}