getCommandFactory() public method

Returns the command factory used by the client.
public getCommandFactory ( ) : Predis\Command\FactoryInterface
return Predis\Command\FactoryInterface
コード例 #1
0
ファイル: Atomic.php プロジェクト: nrk/predis
 /**
  * {@inheritdoc}
  */
 public function __construct(ClientInterface $client)
 {
     if (!$client->getCommandFactory()->supportsCommands(array('multi', 'exec', 'discard'))) {
         throw new ClientException("'MULTI', 'EXEC' and 'DISCARD' are not supported by the current command factory.");
     }
     parent::__construct($client);
 }
コード例 #2
0
ファイル: MultiExec.php プロジェクト: nrk/predis
 /**
  * Checks if the passed client instance satisfies the required conditions
  * needed to initialize the transaction object.
  *
  * @param ClientInterface $client Client instance used by the transaction object.
  *
  * @throws NotSupportedException
  */
 private function assertClient(ClientInterface $client)
 {
     if ($client->getConnection() instanceof AggregateConnectionInterface) {
         throw new NotSupportedException('Cannot initialize a MULTI/EXEC transaction over aggregate connections.');
     }
     if (!$client->getCommandFactory()->supportsCommands(array('MULTI', 'EXEC', 'DISCARD'))) {
         throw new NotSupportedException('MULTI, EXEC and DISCARD are not supported by the current command factory.');
     }
 }
コード例 #3
0
ファイル: Consumer.php プロジェクト: nrk/predis
 /**
  * Checks if the passed client instance satisfies the required conditions
  * needed to initialize a monitor consumer.
  *
  * @param ClientInterface $client Client instance used by the consumer.
  *
  * @throws NotSupportedException
  */
 private function assertClient(ClientInterface $client)
 {
     if ($client->getConnection() instanceof AggregateConnectionInterface) {
         throw new NotSupportedException('Cannot initialize a monitor consumer over aggregate connections.');
     }
     if ($client->getCommandFactory()->supportsCommand('MONITOR') === false) {
         throw new NotSupportedException("'MONITOR' is not supported by the current command factory.");
     }
 }
コード例 #4
0
ファイル: Consumer.php プロジェクト: nrk/predis
 /**
  * Checks if the client instance satisfies the required conditions needed to
  * initialize a PUB/SUB consumer.
  *
  * @param ClientInterface $client Client instance used by the consumer.
  *
  * @throws NotSupportedException
  */
 private function checkCapabilities(ClientInterface $client)
 {
     if ($client->getConnection() instanceof AggregateConnectionInterface) {
         throw new NotSupportedException('Cannot initialize a PUB/SUB consumer over aggregate connections.');
     }
     $commands = array('publish', 'subscribe', 'unsubscribe', 'psubscribe', 'punsubscribe');
     if ($client->getCommandFactory()->supportsCommands($commands) === false) {
         throw new NotSupportedException('PUB/SUB commands are not supported by the current command factory.');
     }
 }
コード例 #5
0
ファイル: CursorBasedIterator.php プロジェクト: nrk/predis
 /**
  * Ensures that the client supports the specified Redis command required to
  * fetch elements from the server to perform the iteration.
  *
  * @param ClientInterface $client    Client connected to Redis.
  * @param string          $commandID Command ID.
  *
  * @throws NotSupportedException
  */
 protected function requiredCommand(ClientInterface $client, $commandID)
 {
     if (!$client->getCommandFactory()->supportsCommand($commandID)) {
         throw new NotSupportedException("'{$commandID}' is not supported by the current command factory.");
     }
 }