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


PHP Client::createCommand方法代碼示例

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


在下文中一共展示了Client::createCommand方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: testCreatesNewCommandUsingSpecifiedProfile

 /**
  * @group disconnected
  */
 public function testCreatesNewCommandUsingSpecifiedProfile()
 {
     $ping = ServerProfile::getDefault()->createCommand('ping', array());
     $profile = $this->getMock('Predis\\Profile\\ServerProfileInterface');
     $profile->expects($this->once())->method('createCommand')->with('ping', array())->will($this->returnValue($ping));
     $client = new Client(null, array('profile' => $profile));
     $this->assertSame($ping, $client->createCommand('ping', array()));
 }
開發者ID:rodrigopbel,項目名稱:ong,代碼行數:11,代碼來源:ClientTest.php

示例7: clear

 /**
  * clear all redis cache.
  */
 public function clear()
 {
     $this->redis->executeCommand($this->redis->createCommand('FLUSHALL'));
 }
開發者ID:victoire,項目名稱:victoire,代碼行數:7,代碼來源:WidgetCache.php

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