當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。