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


PHP Client::pipeline方法代码示例

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


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

示例1: markUserOnline

 public function markUserOnline($pageKey, $userIdent)
 {
     $thisMinute = floor(time() / 60) * 60;
     $key = $this->makeUsersOnlineKey($pageKey, $thisMinute);
     $this->redis->pipeline(function (Pipeline $p) use($key, $userIdent) {
         $p->sadd($key, $userIdent);
         $p->expire($key, self::ONLINE_MINUTES * 60);
     });
 }
开发者ID:skrz,项目名称:cc15-mongo-es-redis-rabbitmq,代码行数:9,代码来源:RedisService.php

示例2: multiPut

 /**
  * @param string $queueName
  * @param array  $workloads
  */
 public function multiPut($queueName, array $workloads)
 {
     $pipeline = $this->predis->pipeline();
     foreach ($workloads as $workload) {
         /** @noinspection PhpUndefinedMethodInspection */
         $pipeline->lpush($queueName, serialize($workload));
     }
     $pipeline->execute();
 }
开发者ID:riverline,项目名称:worker-bundle,代码行数:13,代码来源:PRedis.php

示例3: set

 public function set($keyValue)
 {
     $pipe = $this->redis->pipeline();
     foreach ($keyValue as $key => $value) {
         if (!is_null($value)) {
             $value = json_encode($value);
             $pipe->setex($key, 86400, $value);
             // 缓存 1 天
         }
     }
     return $pipe->execute();
 }
开发者ID:angejia,项目名称:pea,代码行数:12,代码来源:RedisCache.php

示例4: updateValues

 /**
  *
  */
 private function updateValues()
 {
     $this->registeredStates = $this->redis->smembers(self::STATE_MACHINE_NAMESPACE . 'registry');
     if (count($this->registeredStates) > 0) {
         $currentValueRedisKeys = array_map([$this, 'buildCurrentKey'], $this->registeredStates);
         $previousValueRedisKeys = array_map([$this, 'buildPreviousKey'], $this->registeredStates);
         list($currentValues, $previousValues) = $this->redis->pipeline(function (Pipeline $pipe) use($currentValueRedisKeys, $previousValueRedisKeys) {
             $pipe->mget($currentValueRedisKeys);
             $pipe->mget($previousValueRedisKeys);
         });
         $this->currentValues = array_combine($this->registeredStates, $currentValues);
         $this->previousValues = array_combine($this->registeredStates, $previousValues);
     }
 }
开发者ID:akentner,项目名称:incoming-ftp,代码行数:17,代码来源:StateMachine.php

示例5: setMany

 /**
  * Inserts many items in the cache.
  *
  * @param array $values
  * @param int $minutes
  *
  * @return mixed
  */
 public function setMany(array $values, int $minutes)
 {
     $this->predis->pipeline(function ($pipe) use($values, $minutes) {
         foreach ($values as $key => $value) {
             $value = is_numeric($value) ? $value : serialize($value);
             $pipe->setex($this->prefix . $key, 60 * $minutes, $value);
         }
     });
 }
开发者ID:domynation,项目名称:domynation-framework,代码行数:17,代码来源:RedisCache.php

示例6: remClear

 /**
  * Clear the entire cache.
  */
 public static function remClear()
 {
     $keys = self::remAllKeys();
     self::$_redis->pipeline(function ($pipe) use($keys) {
         foreach ($keys as $key) {
             Rem::remDeleteKey($key, $pipe);
         }
     });
 }
开发者ID:chriskite,项目名称:rem,代码行数:12,代码来源:Rem.php

示例7: storePosts

 /**
  * Batch store
  */
 public function storePosts()
 {
     if (!$this->isValid()) {
         return false;
     }
     try {
         // would break this up i.e. only pipeline 5000 at a time
         $this->storage->pipeline(function ($pipe) {
             foreach ($this->rawpost->getData() as $data) {
                 $postback = [];
                 $postback['method'] = $this->rawpost->getMethod();
                 $postback['url'] = $this->rawpost->getUrl();
                 $postback['data'] = $data;
                 $pipe->lpush('job-queue', json_encode($postback));
             }
         });
     } catch (\Exception $e) {
         $this->error = $e->getMessage();
         return false;
     }
     return true;
 }
开发者ID:jessecascio,项目名称:postback-example,代码行数:25,代码来源:PostStore.php

示例8: testPipelineWithArrayAndCallableExecutesPipelineWithOptions

 /**
  * @group disconnected
  */
 public function testPipelineWithArrayAndCallableExecutesPipelineWithOptions()
 {
     $executor = $this->getMock('Predis\\Pipeline\\PipelineExecutorInterface');
     $options = array('executor' => $executor);
     $test = $this;
     $mockCallback = function ($pipeline) use($executor, $test) {
         $reflection = new \ReflectionProperty($pipeline, 'executor');
         $reflection->setAccessible(true);
         $test->assertSame($executor, $reflection->getValue($pipeline));
     };
     $callable = $this->getMock('stdClass', array('__invoke'));
     $callable->expects($this->once())->method('__invoke')->with($this->isInstanceOf('Predis\\Pipeline\\PipelineContext'))->will($this->returnCallback($mockCallback));
     $client = new Client();
     $client->pipeline($options, $callable);
 }
开发者ID:rodrigopbel,项目名称:ong,代码行数:18,代码来源:ClientTest.php

示例9: createPipeline

 public function createPipeline()
 {
     return $this->redis->pipeline();
 }
开发者ID:maximebf,项目名称:cachecache,代码行数:4,代码来源:Redis.php

示例10: testPipelineWithCallableExecutesPipeline

 /**
  * @group disconnected
  */
 public function testPipelineWithCallableExecutesPipeline()
 {
     $callable = $this->getMock('stdClass', array('__invoke'));
     $callable->expects($this->once())->method('__invoke')->with($this->isInstanceOf('Predis\\Pipeline\\Pipeline'));
     $client = new Client();
     $client->pipeline($callable);
 }
开发者ID:pikniktech,项目名称:dailybriefweb2,代码行数:10,代码来源:ClientTest.php


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