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


PHP Client::smembers方法代码示例

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


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

示例1: 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

示例2: tweet

 /**
  * @param string $status
  */
 public function tweet($status)
 {
     $postId = $this->redisClient->incr("global:nextPostId");
     $userId = $this->session->get('userId');
     $post = $userId . "|" . (new \DateTime())->format('d/m/y') . "|" . $status;
     $this->redisClient->set("post:{$postId}", $post);
     $followers = $this->redisClient->smembers("uid:" . $userId . ":followers");
     if ($followers === false) {
         $followers = [];
     }
     $followers[] = $userId;
     foreach ($followers as $fid) {
         $this->redisClient->lpush("uid:{$fid}:posts", [$postId]);
     }
     $this->redisClient->lpush("global:timeline", [$postId]);
     $this->redisClient->ltrim("global:timeline", 0, 1000);
 }
开发者ID:KrunoKnego,项目名称:Symfony-Twitter-Clone,代码行数:20,代码来源:RedisTweet.php

示例3: remAllKeys

 private static function remAllKeys()
 {
     $keys = array();
     $prefix_key = Key::getIndexKey();
     $prefixes = self::$_redis->smembers($prefix_key);
     foreach ($prefixes as $prefix) {
         $suffixes = self::$_redis->smembers($prefix);
         foreach ($suffixes as $suffix) {
             $keys[] = Key::fromString($prefix . ":" . $suffix);
         }
     }
     return $keys;
 }
开发者ID:chriskite,项目名称:rem,代码行数:13,代码来源:Rem.php

示例4: checkKeyExists

 /**
  * Checks whether a key exists and, optionally, whether it has a given $value
  *
  * @param string $key   The key name
  * @param mixed  $value Optional. If specified, also checks the key has this
  * value. Booleans will be converted to 1 and 0 (even inside arrays)
  *
  * @return bool
  */
 private function checkKeyExists($key, $value = null)
 {
     $type = $this->driver->type($key);
     if (is_null($value)) {
         return $type != 'none';
     }
     $value = $this->boolToString($value);
     switch ($type) {
         case 'string':
             $reply = $this->driver->get($key);
             // Allow non strict equality (2 equals '2')
             $result = $reply == $value;
             break;
         case 'list':
             $reply = $this->driver->lrange($key, 0, -1);
             // Check both arrays have the same key/value pairs + same order
             $result = $reply === $value;
             break;
         case 'set':
             $reply = $this->driver->smembers($key);
             // Only check both arrays have the same values
             sort($reply);
             sort($value);
             $result = $reply === $value;
             break;
         case 'zset':
             $reply = $this->driver->zrange($key, 0, -1, 'WITHSCORES');
             // Check both arrays have the same key/value pairs + same order
             $reply = $this->scoresToFloat($reply);
             $value = $this->scoresToFloat($value);
             $result = $reply === $value;
             break;
         case 'hash':
             $reply = $this->driver->hgetall($key);
             // Only check both arrays have the same key/value pairs (==)
             $result = $reply == $value;
             break;
         default:
             $result = false;
     }
     return $result;
 }
开发者ID:solutionDrive,项目名称:Codeception,代码行数:51,代码来源:Redis.php

示例5: getList

 /**
  * @inheritdoc
  */
 public function getList($listName)
 {
     return $this->predis->smembers($listName);
 }
开发者ID:savritsky,项目名称:cache,代码行数:7,代码来源:PredisDriver.php

示例6: getOnlineUsers

 /**
  * Return all identifiers from set
  * @return array
  */
 public function getOnlineUsers()
 {
     return $this->redisClient->smembers($this->setName);
 }
开发者ID:mikicaivosevic,项目名称:online-users,代码行数:8,代码来源:RedisStorage.php

示例7: getSubscriptions

 /**
  * @param string $commandName
  * @return array
  */
 public function getSubscriptions($commandName)
 {
     return $this->client->smembers(sprintf(self::COMMAND_SUBSCRIPTION_KEY, $this->hashCommandName($commandName)));
 }
开发者ID:fcm,项目名称:GovernorFramework,代码行数:8,代码来源:RedisTemplate.php

示例8: getOnlineUsersIds

 /**
  * Запрос id всех игроков онлайн из redis
  * @return int[]
  */
 public function getOnlineUsersIds() : array
 {
     return $this->redis->smembers(RedisClientInterface::ONLINE_LIST);
 }
开发者ID:samizdam,项目名称:Kingdom,代码行数:8,代码来源:UserService.php

示例9: getSimpleFriendsList

 /**
  * @param int $userId
  * @return array
  */
 public function getSimpleFriendsList($userId)
 {
     $key = sprintf(self::TEMPLATE_KEY, $userId);
     return $this->redis->smembers($key);
 }
开发者ID:avelov,项目名称:techery_friends,代码行数:9,代码来源:FriendsListsService.php

示例10: getSet

 /**
  * 获取集合的全部数据
  * @param $key
  * @return array
  */
 public function getSet($key)
 {
     return $this->redis->smembers($key);
 }
开发者ID:inhere,项目名称:php-librarys,代码行数:9,代码来源:Redis.php

示例11: getListOfRequester

 /**
  * @param int $userId
  * @return array
  */
 public function getListOfRequester($userId)
 {
     $key = sprintf(self::TEMPLATE_ADD_REQUEST, $userId);
     return $this->redis->smembers($key);
 }
开发者ID:avelov,项目名称:techery_friends,代码行数:9,代码来源:RequestedFriendsService.php


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