當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CommandInterface::getId方法代碼示例

本文整理匯總了PHP中Predis\Command\CommandInterface::getId方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommandInterface::getId方法的具體用法?PHP CommandInterface::getId怎麽用?PHP CommandInterface::getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Predis\Command\CommandInterface的用法示例。


在下文中一共展示了CommandInterface::getId方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: process

 /**
  * {@inheritdoc}
  */
 public function process(CommandInterface $command)
 {
     if ($command instanceof PrefixableCommandInterface) {
         $command->prefixKeys($this->prefix);
     } elseif (isset($this->commands[$commandID = strtoupper($command->getId())])) {
         call_user_func($this->commands[$commandID], $command, $this->prefix);
     }
 }
開發者ID:flachesis,項目名稱:predis,代碼行數:11,代碼來源:KeyPrefixProcessor.php

示例2: executeCommand

 /**
  * {@inheritdoc}
  */
 public function executeCommand(CommandInterface $command, callable $callback)
 {
     if ($this->buffer->isEmpty() && ($stream = $this->getResource())) {
         $this->loop->addWriteStream($stream, $this->writableCallback);
     }
     $request = $this->serializer->getRequestMessage($command->getId(), $command->getArguments());
     $this->buffer->append($request);
     $this->commands->enqueue([$command, $callback]);
 }
開發者ID:xzander,項目名稱:predis-async,代碼行數:12,代碼來源:StreamConnection.php

示例3: __construct

 /**
  * @param string|CommandInterface $command   Expected command ID or instance.
  * @param array                   $arguments Expected command arguments.
  */
 public function __construct($command = null, array $arguments = null)
 {
     if ($command instanceof CommandInterface) {
         $this->commandID = strtoupper($command->getId());
         $this->arguments = $arguments ?: $command->getArguments();
     } else {
         $this->commandID = strtoupper($command);
         $this->arguments = $arguments;
     }
 }
開發者ID:GeorgeBroadley,項目名稱:caffeine-vendor,代碼行數:14,代碼來源:RedisCommandConstraint.php

示例4: storeDebug

 private function storeDebug(CommandInterface $command, $direction)
 {
     $firtsArg = $command->getArgument(0);
     $timestamp = round(microtime(true) - $this->tstart, 4);
     $debug = $command->getId();
     $debug .= isset($firtsArg) ? " {$firtsArg} " : ' ';
     $debug .= "{$direction} {$this}";
     $debug .= " [{$timestamp}s]";
     $this->debugBuffer[] = $debug;
 }
開發者ID:flachesis,項目名稱:predis,代碼行數:10,代碼來源:debuggable_connection.php

示例5: serialize

 /**
  * {@inheritdoc}
  */
 public function serialize(CommandInterface $command)
 {
     $commandID = $command->getId();
     $arguments = $command->getArguments();
     $cmdlen = strlen($commandID);
     $reqlen = count($arguments) + 1;
     $buffer = "*{$reqlen}\r\n\${$cmdlen}\r\n{$commandID}\r\n";
     foreach ($arguments as $argument) {
         $arglen = strlen($argument);
         $buffer .= "\${$arglen}\r\n{$argument}\r\n";
     }
     return $buffer;
 }
開發者ID:cdandy,項目名稱:code-lib,代碼行數:16,代碼來源:RequestSerializer.php

示例6: serialize

 /**
  * {@inheritdoc}
  */
 public function serialize(CommandInterface $command)
 {
     $commandId = $command->getId();
     $arguments = $command->getArguments();
     $cmdlen = strlen($commandId);
     $reqlen = count($arguments) + 1;
     $buffer = "*{$reqlen}\r\n\${$cmdlen}\r\n{$commandId}\r\n";
     for ($i = 0, $reqlen--; $i < $reqlen; $i++) {
         $argument = $arguments[$i];
         $arglen = strlen($argument);
         $buffer .= "\${$arglen}\r\n{$argument}\r\n";
     }
     return $buffer;
 }
開發者ID:rodrigopbel,項目名稱:ong,代碼行數:17,代碼來源:TextCommandSerializer.php

示例7: getHash

 /**
  * {@inheritdoc}
  */
 public function getHash(CommandInterface $command)
 {
     $hash = $command->getHash();
     if (!isset($hash) && isset($this->commands[$cmdID = $command->getId()])) {
         $key = call_user_func($this->commands[$cmdID], $command);
         if (isset($key)) {
             $hash = $this->getKeyHash($key);
             $command->setHash($hash);
         }
     }
     return $hash;
 }
開發者ID:Yatko,項目名稱:Gifteng,代碼行數:15,代碼來源:PredisClusterHashStrategy.php

示例8: writeCommand

 /**
  * {@inheritdoc}
  */
 public function writeCommand(CommandInterface $command)
 {
     $commandId = $command->getId();
     $arguments = $command->getArguments();
     $cmdlen = strlen($commandId);
     $reqlen = count($arguments) + 1;
     $buffer = "*{$reqlen}\r\n\${$cmdlen}\r\n{$commandId}\r\n";
     for ($i = 0; $i < $reqlen - 1; $i++) {
         $argument = $arguments[$i];
         $arglen = strlen($argument);
         $buffer .= "\${$arglen}\r\n{$argument}\r\n";
     }
     $this->writeBytes($buffer);
 }
開發者ID:rubensayshi,項目名稱:predis,代碼行數:17,代碼來源:StreamConnection.php

示例9: writeCommand

 /**
  * {@inheritdoc}
  */
 public function writeCommand(CommandInterface $command)
 {
     $cmdargs = $command->getArguments();
     array_unshift($cmdargs, $command->getId());
     $this->write(phpiredis_format_command($cmdargs));
 }
開發者ID:surjit,項目名稱:node-redis-php-chat-app,代碼行數:9,代碼來源:PhpiredisConnection.php

示例10: isDisallowedOperation

 /**
  * Returns if the specified command is not allowed for execution in a master
  * / slave replication context.
  *
  * @param CommandInterface $command Command instance.
  *
  * @return bool
  */
 public function isDisallowedOperation(CommandInterface $command)
 {
     return isset($this->disallowed[$command->getId()]);
 }
開發者ID:sohel4r,項目名稱:wordpress_4_1_1,代碼行數:12,代碼來源:predis.php

示例11: getCommandId

 /**
  * Checks if the specified command is supported by this connection class.
  *
  * @param CommandInterface $command Command instance.
  *
  * @return string
  *
  * @throws NotSupportedException
  */
 protected function getCommandId(CommandInterface $command)
 {
     switch ($commandID = $command->getId()) {
         case 'AUTH':
         case 'SELECT':
         case 'MULTI':
         case 'EXEC':
         case 'WATCH':
         case 'UNWATCH':
         case 'DISCARD':
         case 'MONITOR':
             throw new NotSupportedException("Command '{$commandID}' is not allowed by Webdis.");
         default:
             return $commandID;
     }
 }
開發者ID:creativeprogramming,項目名稱:NodeJS-Helper,代碼行數:25,代碼來源:WebdisConnection.php

示例12: getHash

 /**
  * {@inheritdoc}
  */
 public function getHash(CommandInterface $command)
 {
     $hash = $command->getHash();
     if (!isset($hash) && isset($this->commands[$cmdID = $command->getId()])) {
         if (null !== ($key = call_user_func($this->commands[$cmdID], $command))) {
             $hash = $this->hashGenerator->hash($key);
             $command->setHash($hash);
         }
     }
     return $hash;
 }
開發者ID:rubensayshi,項目名稱:predis,代碼行數:14,代碼來源:RedisClusterHashStrategy.php

示例13: getSlot

 /**
  * {@inheritdoc}
  */
 public function getSlot(CommandInterface $command)
 {
     $slot = $command->getSlot();
     if (!isset($slot) && isset($this->commands[$cmdID = $command->getId()])) {
         $key = call_user_func($this->commands[$cmdID], $command);
         if (isset($key)) {
             $slot = $this->getSlotByKey($key);
             $command->setSlot($slot);
         }
     }
     return $slot;
 }
開發者ID:hanxiansen,項目名稱:laravel-5-blog,代碼行數:15,代碼來源:ClusterStrategy.php

示例14: getCommandId

 /**
  * Checks if the specified command is supported by this connection class.
  *
  * @param  CommandInterface $command The instance of a Redis command.
  * @return string
  */
 protected function getCommandId(CommandInterface $command)
 {
     switch ($commandId = $command->getId()) {
         case 'AUTH':
         case 'SELECT':
         case 'MULTI':
         case 'EXEC':
         case 'WATCH':
         case 'UNWATCH':
         case 'DISCARD':
         case 'MONITOR':
             throw new NotSupportedException("Disabled command: {$command->getId()}");
         default:
             return $commandId;
     }
 }
開發者ID:biswars,項目名稱:retwis,代碼行數:22,代碼來源:WebdisConnection.php

示例15: georadius

 /**
  * Applies the specified prefix to the key of a GEORADIUS command.
  *
  * @param CommandInterface $command Command instance.
  * @param string           $prefix  Prefix string.
  */
 public static function georadius(CommandInterface $command, $prefix)
 {
     if ($arguments = $command->getArguments()) {
         $arguments[0] = "{$prefix}{$arguments[0]}";
         $startIndex = $command->getId() === 'GEORADIUS' ? 5 : 4;
         if (($count = count($arguments)) > $startIndex) {
             for ($i = $startIndex; $i < $count; ++$i) {
                 switch (strtoupper($arguments[$i])) {
                     case 'STORE':
                     case 'STOREDIST':
                         $arguments[$i] = "{$prefix}{$arguments[++$i]}";
                         break;
                 }
             }
         }
         $command->setRawArguments($arguments);
     }
 }
開發者ID:cdandy,項目名稱:code-lib,代碼行數:24,代碼來源:KeyPrefixProcessor.php


注:本文中的Predis\Command\CommandInterface::getId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。