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


PHP Client::hgetall方法代码示例

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


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

示例1: getList

 /**
  * @param int $fireTime
  *
  * @return array
  */
 public function getList($fireTime)
 {
     $list = $this->client->hgetall($this->makeKey($fireTime));
     return array_map(function ($value) {
         return json_decode($value, true);
     }, $list);
 }
开发者ID:jiangyu7408,项目名称:notification,代码行数:12,代码来源:RedisStorage.php

示例2: index

 /**
  * {@inheritdoc}
  */
 public function index() : array
 {
     $features = [];
     foreach ($this->redis->hgetall($this->prefix) as $alias => $feature) {
         $features[$alias] = unserialize($feature);
     }
     return $features;
 }
开发者ID:jadb,项目名称:feature_toggle,代码行数:11,代码来源:RedisStorage.php

示例3: loadUserById

 /**
  * @param int $userId
  * @return UserVO
  * @throws UserNotFoundException
  */
 public function loadUserById(int $userId) : UserVO
 {
     $redisUser = $this->redis->hgetall($this->getKey($userId));
     if (empty($redisUser)) {
         throw new UserNotFoundException(sprintf('User "%d" does not exist.', $userId));
     }
     return $this->buildUserVO($userId, $redisUser);
 }
开发者ID:brainexe,项目名称:core,代码行数:13,代码来源:LoadUser.php

示例4: getUserInfo

 /**
  * @param string $sessionId
  * @return array
  */
 public function getUserInfo($sessionId)
 {
     $userInfo = $this->redis->hgetall('session_' . $sessionId);
     if (!$userInfo) {
         throw new \RuntimeException('Session not found');
     }
     return $userInfo;
 }
开发者ID:squarer,项目名称:symfony3-demo,代码行数:12,代码来源:AppExtension.php

示例5: getRateInfo

 public function getRateInfo($key)
 {
     $info = $this->client->hgetall($key);
     $rateLimitInfo = new RateLimitInfo();
     $rateLimitInfo->setLimit($info['limit']);
     $rateLimitInfo->setCalls($info['calls']);
     $rateLimitInfo->setResetTimestamp($info['reset']);
     return $rateLimitInfo;
 }
开发者ID:Privax,项目名称:RateLimitBundle,代码行数:9,代码来源:Redis.php

示例6: get

 /**
  * @param string $sid
  *
  * @return Session|null
  */
 public function get($sid)
 {
     $session = null;
     if (UUID::isValid($sid)) {
         $data = $this->redis->hgetall($this->buildKey($sid));
         if (count($data)) {
             $session = new Session($sid, $this->getRealm(), $data);
         }
     }
     return $session;
 }
开发者ID:akentner,项目名称:incoming-ftp,代码行数:16,代码来源:RedisSessionProvider.php

示例7: getById

 /**
  * @inheritdoc
  */
 public function getById(\string $id) : CustomerView
 {
     $key = self::KEY . ':' . $id;
     if ($this->client->exists($key)) {
         $item = $this->client->hgetall($key);
         $model = $this->createViewModel($item);
     } else {
         $model = $this->repository->getById($id);
         $this->save($model);
     }
     return $model;
 }
开发者ID:igaponov,项目名称:shop,代码行数:15,代码来源:CustomerViewRepository.php

示例8: getAllIndexed

 /**
  * @inheritDoc
  */
 public function getAllIndexed() : array
 {
     if (!$this->client->exists($this->key)) {
         $data = $this->repository->getAllIndexed();
         if ($data) {
             $this->client->hmset($this->key, $data);
         }
     } else {
         $data = $this->client->hgetall($this->key);
     }
     return $data;
 }
开发者ID:igaponov,项目名称:shop,代码行数:15,代码来源:DirectoryViewRepository.php

示例9: testHandleLogWithJob

 public function testHandleLogWithJob()
 {
     $job = new ImageJob();
     $job->setBeginning('begin');
     $job->setEnd('end');
     $frame = new Frame('MESSAGE', array('delivery_tag' => 'delivery-' . mt_rand()), $job->toJson());
     $loop = LoopFactory::create();
     $options = array('eventloop' => $loop, 'on_error' => array($this, 'throwRedisError'));
     $redisSync = new PredisSync('tcp://127.0.0.1:6379');
     $redisSync->connect();
     $resolver = $this->getResolver();
     $resolver->expects($this->once())->method('ack');
     $done = false;
     $phpunit = $this;
     $redis = new PredisAsync('tcp://127.0.0.1:6379', $options);
     $redis->connect(function () use($phpunit, $redis, $frame, $redisSync, &$done, $resolver) {
         $component = new LogBuilderComponent();
         $component->handleLog($redis, $phpunit->getLogger(), $frame, $resolver)->then(function ($hashId) use($phpunit, $redis, $redisSync, &$done) {
             $redis->disconnect();
             $data = $redisSync->hgetall($hashId);
             $phpunit->assertGreaterThan(0, count($data));
             $phpunit->assertEquals('Gloubster\\Message\\Job\\ImageJob', $data['type']);
             $phpunit->assertTrue($redisSync->sismember('jobs', $hashId));
             $done = true;
         });
     });
     $loop->run();
     $this->assertTrue($done);
 }
开发者ID:gloubster,项目名称:server,代码行数:29,代码来源:LogBuilderComponentTest.php

示例10: getAll

 /**
  * @return array|null
  */
 public function getAll()
 {
     $extensionsSerialize = $this->redisClient->hgetall(self::EXTENSION_HASH_STORE);
     if (!$extensionsSerialize) {
         return;
     }
     $result = [];
     foreach ($extensionsSerialize as $serialized) {
         $extension = new Extension();
         $extension->unserialize($serialized);
         $meta = json_decode($this->redisClient->hget(self::EXTENSIONMETA_HASH_STORE, $extension->getName()), true);
         $extension->setWatchers($meta['watchers']);
         $extension->setStars($meta['stars']);
         $result[$extension->getName()] = $extension;
     }
     return $result;
 }
开发者ID:Doanlmit,项目名称:pickleweb,代码行数:20,代码来源:ExtensionRepository.php

示例11: find

 /**
  * @param mixed $id
  *
  * @return object
  */
 public function find($id)
 {
     $metadata = $this->getMetadataFor($this->className);
     $key = $this->keyNamingStrategy->getKeyName(array($metadata->getPrefix(), $id));
     $data = $this->redis->hgetall($key);
     if (empty($data)) {
         return;
     }
     return $this->hydrator->hydrate($this->newObject(), $data, $metadata);
 }
开发者ID:tystr,项目名称:redis-orm,代码行数:15,代码来源:ObjectRepository.php

示例12: htGetAll

 /**
  * @param $key
  * @param bool $valToInt
  * @return array
  */
 public function htGetAll($key, $valToInt = false)
 {
     $data = $this->redis->hgetall($key);
     if ($valToInt) {
         array_walk($data, function (&$val) {
             $val = (int) $val;
         });
     }
     return $data;
 }
开发者ID:inhere,项目名称:php-librarys,代码行数:15,代码来源:Redis.php

示例13: home

 public function home()
 {
     $redis = new Client();
     $date = $redis->hget('update', 'index');
     $index = $redis->hgetall('index');
     $sorts = array_values(BiliBiliHelper::getSorts());
     foreach ($sorts as $sort) {
         $index[$sort] = json_decode($index[$sort], true);
     }
     return view('index')->with('content', $index)->with('sorts', $sorts)->with('update_time', $date);
 }
开发者ID:HouseStark,项目名称:BiliPusher,代码行数:11,代码来源:HomeController.php

示例14: getDistributions

 /**
  * Get distributions given an event and a set of dates
  *
  * [
  *      "value3": 24,
  *      "value7": 13,
  *      "value8": 9,
  * ]
  *
  * @param string $token Event
  * @param string $event Token
  * @param array  $dates Dates
  *
  * @return array Distribution with totals
  */
 public function getDistributions($token, $event, array $dates)
 {
     $distributions = [];
     foreach ($dates as $date) {
         $key = $this->generateEntryKey($token, $event, $date);
         $partials = $this->redis->hgetall($key . '_distr');
         foreach ($partials as $key => $value) {
             $distributions[$key] = isset($partialTotals[$key]) ? $distributions[$key] + $value : $value;
         }
     }
     arsort($distributions);
     return $distributions;
 }
开发者ID:xphere,项目名称:elcodi,代码行数:28,代码来源:RedisMetricsBucket.php

示例15: recoverByRemoteAddress

 /**
  * @param string $remoteAddress
  *
  * @return Session|null
  */
 public function recoverByRemoteAddress($remoteAddress)
 {
     $session = null;
     $oracleData = $this->findSessionInOracleByRemoteAddress($remoteAddress);
     if (count($oracleData) === 1) {
         $sid = $oracleData[0]['sid'];
         $redisKey = $this->buildKey($sid);
         $data = $this->redis->hgetall($redisKey);
         if (!$data) {
             $data['userId'] = (int) $oracleData[0]['userId'];
             $data['userScreenname'] = $oracleData[0]['userScreenname'];
         }
         $this->redis->hmset($redisKey, $data);
         $this->redis->expire($redisKey, $this->getExpires());
         $session = new Session($sid, $this->getRealm(), $data);
     }
     return $session;
 }
开发者ID:akentner,项目名称:incoming-ftp,代码行数:23,代码来源:OracleHookedRedisSessionProvider.php


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