当前位置: 首页>>代码示例>>PHP>>正文


PHP Client::executeCommand方法代码示例

本文整理汇总了PHP中Predis\Client::executeCommand方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::executeCommand方法的具体用法?PHP Client::executeCommand怎么用?PHP Client::executeCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Predis\Client的用法示例。


在下文中一共展示了Client::executeCommand方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: set

 /**
  * * 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);
     }
 }
开发者ID:alambike,项目名称:phpback,代码行数:16,代码来源:Redis.php

示例2: set

 /**
  * {@inheritdoc}
  */
 public function set($key, $value, $ttl = null)
 {
     $this->predis->set($key, $this->pack($value));
     if (!$ttl) {
         $ttl = $this->ttl;
     }
     $cmd = $this->predis->createCommand('EXPIRE');
     $cmd->setArguments([$key, $ttl]);
     $this->predis->executeCommand($cmd);
 }
开发者ID:jeffery,项目名称:Cache,代码行数:13,代码来源:Predis.php

示例3: doIncrement

 /**
  * @param string         $cmd     The command
  * @param Counter|string $counter The counter
  * @param int            $value   The value
  *
  * @return Counter
  */
 protected function doIncrement($cmd, $counter, $value)
 {
     $counter = $this->transformCounter($counter);
     $cmd = $this->client->createCommand($cmd, array($counter->getName(), $value));
     $value = (int) $this->client->executeCommand($cmd);
     return new Counter($counter->getName(), $value);
 }
开发者ID:sonatra,项目名称:cache,代码行数:14,代码来源:RedisCache.php

示例4: getIdsByAnyTags

 /**
  * @param string[] $tags
  * @return string[] Ids
  */
 public function getIdsByAnyTags(array $tags)
 {
     $command = $this->redis->createCommand('sunion', $this->getIdsForTagKeys($tags));
     $response = $this->redis->executeCommand($command);
     if ($response instanceof ResponseErrorInterface) {
         return null;
     }
     return $response;
 }
开发者ID:layeredcache,项目名称:layeredcache,代码行数:13,代码来源:Predis.php

示例5: execute

 /**
  * Execute commands
  * 
  * @param string $command
  * @param array $parameters
  * 
  * @return mixed
  */
 public function execute($command, $parameters = array())
 {
     try {
         $cmdSet = $this->client->createCommand($command, $parameters);
         return $this->client->executeCommand($cmdSet);
     } catch (\Exception $e) {
         $this->exception = $e;
         return false;
     }
 }
开发者ID:ringoteam,项目名称:phpredmon-lib,代码行数:18,代码来源:InstanceWorker.php

示例6: listenToPubSub

 /**
  * Start listening to subscribed channels of the Redis PubSub mechanism.
  * Add a callback to a particular subscription channel.
  *
  * @param callable $callback
  * @return void
  */
 public function listenToPubSub(callable $callback)
 {
     while (1) {
         $command = RawCommand::create('PSUBSCRIBE', sprintf('%s-%s', $this->pubsub_channel_prefix, '*'));
         $this->client->executeCommand($command);
         if ($this->client->getConnection() instanceof MasterSlaveReplication) {
             $payload = $this->client->getConnection()->getConnection($command)->read();
         } else {
             $payload = $this->client->getConnection()->read();
         }
         $channel = ltrim($payload[2], sprintf('%s%s', $this->pubsub_channel_prefix, '-'));
         $message = base64_decode($payload[3]);
         call_user_func($callback, ['channel' => $channel, 'message' => $message]);
     }
 }
开发者ID:bravo3,项目名称:orm,代码行数:22,代码来源:RedisDriver.php

示例7: testClientResendScriptedCommandUsingEvalOnNoScriptErrors

 /**
  * @group disconnected
  */
 public function testClientResendScriptedCommandUsingEvalOnNoScriptErrors()
 {
     $command = $this->getMockForAbstractClass('Predis\\Command\\ScriptedCommand', array(), '', true, true, true, array('parseResponse'));
     $command->expects($this->once())->method('getScript')->will($this->returnValue('return redis.call(\'exists\', KEYS[1])'));
     $command->expects($this->once())->method('parseResponse')->with('OK')->will($this->returnValue(true));
     $connection = $this->getMock('Predis\\Connection\\SingleConnectionInterface');
     $connection->expects($this->at(0))->method('executeCommand')->with($command)->will($this->returnValue(new ResponseError('NOSCRIPT')));
     $connection->expects($this->at(1))->method('executeCommand')->with($this->isInstanceOf('Predis\\Command\\ServerEval'))->will($this->returnValue('OK'));
     $client = new Client($connection);
     $this->assertTrue($client->executeCommand($command));
 }
开发者ID:rodrigopbel,项目名称:ong,代码行数:14,代码来源:ClientTest.php

示例8: clear

 /**
  * clear all redis cache.
  */
 public function clear()
 {
     $this->redis->executeCommand($this->redis->createCommand('FLUSHALL'));
 }
开发者ID:victoire,项目名称:victoire,代码行数:7,代码来源:WidgetCache.php

示例9: testExecuteCommand

 /**
  * @group disconnected
  */
 public function testExecuteCommand()
 {
     $ping = ServerProfile::getDefault()->createCommand('ping', array());
     $connection = $this->getMock('Predis\\Network\\IConnection');
     $connection->expects($this->once())->method('executeCommand')->with($ping)->will($this->returnValue(true));
     $client = new Client($connection);
     $this->assertTrue($client->executeCommand($ping));
 }
开发者ID:keneanung,项目名称:gw2spidy,代码行数:11,代码来源:ClientTest.php

示例10: executeCommand

 /**
  * Execute a Predis command
  *
  * @param   string  $name
  * @param   array   $arguments
  * @return  mixed
  */
 protected function executeCommand($name, array $arguments)
 {
     $command = $this->client->createCommand($name, $arguments);
     return $this->client->executeCommand($command);
 }
开发者ID:limweb,项目名称:webappservice,代码行数:12,代码来源:Predis.php


注:本文中的Predis\Client::executeCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。