Predis\Client::executeCommand PHP Method

executeCommand() public method

public executeCommand ( Predis\Command\CommandInterface $command )
$command Predis\Command\CommandInterface
    public function executeCommand(CommandInterface $command)
    {
        $response = $this->connection->executeCommand($command);
        if ($response instanceof ResponseInterface) {
            if ($response instanceof ErrorResponseInterface) {
                $response = $this->onErrorResponse($command, $response);
            }
            return $response;
        }
        return $command->parseResponse($response);
    }

Usage Example

Example #1
0
 /**
  * * Add a value to the cache under a unique key
  *
  * @param string $key
  * @param mixed  $value
  * @param int    $ttl
  */
 public function set($key, $value, $ttl = null)
 {
     $this->client->set($key, $value);
     if ($ttl) {
         $cmd = $this->client->createCommand('EXPIRE');
         $cmd->setArguments(array($key, $ttl));
         $this->client->executeCommand($cmd);
     }
 }
All Usage Examples Of Predis\Client::executeCommand