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


PHP Redis::smembers方法代码示例

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


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

示例1: getHashes

 /**
  * Returns a list of all affected hashes for a given set of tags.
  *
  * @param array $tags
  *
  * @return array
  */
 private function getHashes(array $tags)
 {
     $hashes = [];
     foreach ($tags as $tag) {
         $tag = $this->redis->prefix($tag);
         if (!$this->redis->exists($tag)) {
             continue;
         }
         $hashes = array_merge($hashes, $this->redis->smembers($tag));
     }
     return array_unique($hashes);
 }
开发者ID:spiritix,项目名称:lada-cache,代码行数:19,代码来源:Invalidator.php

示例2: features

 /**
  * Get a list of features
  * @return An arry containing a list of features for a project and user
  */
 public function features()
 {
     $features_list = $this->redis->smembers("{$this->_feature_namespace()}:features");
     $pipe = $this->redis->multi(Redis::PIPELINE);
     foreach ($features_list as $feature) {
         $pipe->hgetall("{$this->_feature_namespace()}:feature:{$feature}");
     }
     $feature_data = $pipe->exec();
     $features = [];
     foreach ($features_list as $key => $feature) {
         $features[$feature] = $feature_data[$key];
     }
     return $features;
 }
开发者ID:kkwoker,项目名称:php-dark-launch,代码行数:18,代码来源:Dark_Launch.php

示例3: testsmembers

 public function testsmembers()
 {
     $this->redis->del('set');
     $this->redis->sAdd('set', 'val');
     $this->redis->sAdd('set', 'val2');
     $this->redis->sAdd('set', 'val3');
     $array = array('val', 'val2', 'val3');
     $smembers = $this->redis->smembers('set');
     sort($smembers);
     $this->assertEquals($array, $smembers);
     $sMembers = $this->redis->sMembers('set');
     sort($sMembers);
     $this->assertEquals($array, $sMembers);
     // test alias
 }
开发者ID:Jerry-Shaw,项目名称:phpredis,代码行数:15,代码来源:RedisTest.php

示例4: surveys

 public function surveys()
 {
     return Redis::smembers("User:{$this->id}:surveys");
 }
开发者ID:nickyleach,项目名称:OSTSurvey,代码行数:4,代码来源:User.php

示例5: features

 /**
  * Get a list of features
  * @return An arry containing a list of features for a project and user
  */
 public function features()
 {
     return $this->redis->smembers("{$this->_feature_namespace()}:features");
 }
开发者ID:killerwails,项目名称:php-dark-launch,代码行数:8,代码来源:Dark_Launch.php

示例6: load

	protected function load($id){
		$data = Redis::hgetall("Repository::$id");
		
		foreach($data as $key => $val){
			if($key % 2 == 0){
				$this->$val = json_decode($data[$key + 1], true);
			}
		}
		
		$this->files = Redis::smembers("Repository.Source::$id");
		
		$this->id = $id;
	}
开发者ID:nickyleach,项目名称:OSS-Match,代码行数:13,代码来源:Repository.php

示例7: types

 /**
  * Get all types
  *
  * @return mixed
  */
 public function types()
 {
     return $this->client->smembers('q:job:types');
 }
开发者ID:coderofsalvation,项目名称:php-kue,代码行数:9,代码来源:Kue.php

示例8: getPausedWorker

 /**
  * Return a list of paused workers
  *
  * @since 0.0.1
  * @return  array   An array of paused workers' name
  */
 public function getPausedWorker()
 {
     return (array) $this->redis->smembers(self::$pausedWorkerKey);
 }
开发者ID:nosun,项目名称:php-resque-cronjob,代码行数:10,代码来源:ResqueStatus.php

示例9: getAllTubesNames

 /**
  * 获取所有管道(tube)名
  *
  * @return mixed
  */
 public function getAllTubesNames()
 {
     return $this->client->smembers($this->name . ':' . Job::TUBES_TAB);
 }
开发者ID:lezhizhe,项目名称:RedisQueue-as-like-beanstalkd,代码行数:9,代码来源:Queue.php

示例10: rand

echo $redis->lset("list", 1, "new_value");
$data = $redis->lRange("list", 0, -1);
echo "<pre>";
print_r($data);
$bool = $redis->ltrim("list", 0, 5);
echo $redis->lrem("list", "5");
$bool = $redis->rpoplpush("srcKey", "dstKey");
// SET
for ($i = 0; $i < 10; $i++) {
    $redis->sadd("myset", $i + rand(10, 99));
}
$bool = $redis->srem("myset", 16);
echo (int) $bool;
$bool = $redis->sMove("myset", "myset1", 35);
echo $bool;
$data = $redis->smembers("myset");
$bool = $redis->sismember("myset", 555);
echo (int) $bool;
echo $redis->scard("myset");
$redis->sinterstore("output", "myset", "myset1");
$data = $redis->smembers("output");
echo "<pre>";
// sort
$data = $redis->sort("myset", array("sort" => "desc"));
echo "<pre>";
print_r($data);
for ($i = 0; $i < 10; $i++) {
    $redis->zadd("zset", $i + rand(10, 99), $i + rand(100, 999));
}
$data = $redis->zrange("zset", 0, 3, "withscores");
echo "<pre>";
开发者ID:isS,项目名称:NoSQL,代码行数:31,代码来源:redisWithPHP.php

示例11:

描述:执行sInter命令并把结果储存到新建的变量中。
参数:
Key: dstkey, the key to store the diff into.
Keys: key1, key2… keyN. key1..keyN are intersected as in sInter.
返回值:成功返回,交集的个数,失败false
*/
$redis->delete('test');
$redis->sadd("test", "111");
$redis->sadd("test", "222");
$redis->sadd("test", "333");
$redis->sadd("test1", "111");
$redis->sadd("test1", "444");
var_dump($redis->sinterstore('new', "test", "test1"));
//结果:int(1)
var_dump($redis->smembers('new'));
//结果:array(1) { [0]=> string(3) "111" }
/**
sunion

描述:
返回一个所有指定键的并集
参数:
Keys: key1, key2, … , keyN
返回值:成功返回合并后的集,失败false
*/
$redis->delete('test');
$redis->sadd("test", "111");
$redis->sadd("test", "222");
$redis->sadd("test", "333");
$redis->sadd("test1", "111");
开发者ID:wujunze,项目名称:bigpan,代码行数:30,代码来源:redis.php


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