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


PHP Redis::hgetall方法代码示例

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


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

示例1: testCreate

 /**
  * Test the creation of a resource
  *
  * @return void
  */
 public function testCreate()
 {
     $this->testingResource = new CreateTestResource();
     $this->assertInstanceOf(TestModel::class, $this->testingResource->user);
     $this->assertEquals($this->testingResource->userData['email'], $this->testingResource->user->email);
     $this->assertArraySubset($this->testingResource->userData, Redis::hgetall($this->testingResource->testModelHashId));
     $this->assertEquals($this->testingResource->user->id, Redis::get($this->testingResource->testModelSearchableId));
 }
开发者ID:ryuske,项目名称:redismodel,代码行数:13,代码来源:CreateResourceTest.php

示例2: testDeleteById

 /**
  * Test the deletion of a resource by ID
  *
  * @return void
  */
 public function testDeleteById()
 {
     $testingResource = new CreateTestResource();
     $testModel = app('TestModel');
     $testModel->delete($testingResource->user->id);
     $this->assertEmpty(Redis::hgetall($testingResource->testModelHashId));
     $this->assertNull(Redis::get($testingResource->testModelSearchableId));
 }
开发者ID:ryuske,项目名称:redismodel,代码行数:13,代码来源:DeleteResourceTest.php

示例3: feature

 /**
  * Get a Dark Launch feature
  * @param $feature string - The namespace when accessing redis
  * @return An array of values - The hash keys and values for the feature
  */
 public function feature($feature_name)
 {
     $dark_launch_feature = $this->redis->hgetall("{$this->feature_namespace()}:feature:{$feature_name}");
     if (!$dark_launch_feature) {
         $this->set_from_config($feature_name);
         $dark_launch_feature = $this->redis->hgetall("{$this->feature_namespace()}:feature:{$feature_name}");
     }
     return $dark_launch_feature ? $dark_launch_feature : $this->_return_error($feature_name);
 }
开发者ID:stevenharradine,项目名称:php-dark-launch,代码行数:14,代码来源:Dark_Launch.php

示例4: feature

 /**
  * Get a Dark Launch feature
  * @param $feature string - The namespace when accessing redis
  * @return An array of values - The hash keys and values for the feature
  */
 public function feature($feature_name)
 {
     $feature_name = str_replace('_', '-', $feature_name);
     $dark_launch_feature = $this->redis->hgetall("{$this->_feature_namespace()}:feature:{$feature_name}");
     if (!$dark_launch_feature) {
         $this->_init_features();
         $dark_launch_feature = $this->redis->hgetall("{$this->_feature_namespace()}:feature:{$feature_name}");
     }
     return $dark_launch_feature ? $dark_launch_feature : $this->_return_error($feature_name);
 }
开发者ID:kkwoker,项目名称:php-dark-launch,代码行数:15,代码来源:Dark_Launch.php

示例5: __construct

 public function __construct($id)
 {
     $this->id = either($id, uniqid());
     $this->exists = false;
     $data = Util::multibulk_to_array(Redis::hgetall($this->key()));
     foreach ($data as $key => $val) {
         $this->{$key} = json_decode($val, true);
     }
     $this->exists = count($data) > 0;
 }
开发者ID:nickyleach,项目名称:OSTSurvey,代码行数:10,代码来源:RedisObject.php

示例6: load

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

示例7: testUpdate

 /**
  * Test updating a resource
  *
  * @return void
  */
 public function testUpdate()
 {
     $this->testingResource = new CreateTestResource();
     $testModel = app('TestModel');
     $testModel->update($this->testingResource->user->id, ['email' => 'kenyon.jh@gmail.com']);
     $testResource = $testModel->get($this->testingResource->user->id);
     $this->testingResource->userData['email'] = 'kenyon.jh@gmail.com';
     $this->testingResource->testModelSearchableId = "testmodel:{$this->testingResource->user->id}:{$this->testingResource->user->id}_kenyon.jh@gmail.com_{$this->testingResource->convertedName}_{$this->testingResource->userData['password']}";
     $this->assertEquals('kenyon.jh@gmail.com', $testResource->email);
     $this->assertArraySubset($this->testingResource->userData, Redis::hgetall($this->testingResource->testModelHashId));
     $this->assertEquals($this->testingResource->user->id, Redis::get($this->testingResource->testModelSearchableId));
 }
开发者ID:ryuske,项目名称:redismodel,代码行数:17,代码来源:UpdateResourceTest.php

示例8: testGettingAHiddenField

 /**
  * Test getting a hidden field in a resource
  *
  * @return void
  */
 public function testGettingAHiddenField()
 {
     $passwordData = ['password' => 'testing'];
     $this->testingResource = new CreateTestResource($passwordData);
     $testModel = app('TestModel');
     $testResource = $testModel->get($this->testingResource->user->id, ['password']);
     $this->assertEquals($this->testingResource->user->id, $testResource->id);
     $this->assertArraySubset($passwordData, Redis::hgetall($this->testingResource->testModelHashId));
     $this->assertNull($testResource->password);
 }
开发者ID:ryuske,项目名称:redismodel,代码行数:15,代码来源:GetResourceTest.php

示例9: setCache

function setCache($type, $arrData = array())
{
    switch ($type) {
        case 'Campaign':
            $redis = new Redis();
            $redis->connect(REDIS_HOST, REDIS_PORT_1);
            $cacheKey = 'Campaign';
            $arrCampaign = $redis->hgetall($cacheKey);
            $servername = DB_HOST . ":" . DB_PORT;
            $username = DB_USERNAME;
            $password = DB_PASSWORD;
            $dbname = DB_NAME;
            $conn = new mysqli($servername, $username, $password, $dbname);
            // Check connection
            if ($conn->connect_error) {
                die("Connection failed: " . $conn->connect_error);
            }
            foreach ($arrData as $data) {
                if (!empty($data)) {
                    //print_r($data);
                    $redis->hset($cacheKey, $data['id'], json_encode($data));
                    unset($arrCampaign[$data['id']]);
                    $campaign_id = $data['id'];
                    $campConvKey = "CampConv_{$campaign_id}";
                    $arrCampConv = $redis->hgetall($campConvKey);
                    $sql = <<<EOF
                    SELECT id, campaign_id
                    FROM pt_conversion
                    WHERE  status = 1
                    AND campaign_id = {$campaign_id}
EOF;
                    $result = $conn->query($sql);
                    $arrTmp = array();
                    if ($result->num_rows > 0) {
                        while ($row = $result->fetch_assoc()) {
                            $arrTmp[] = $row;
                        }
                    }
                    foreach ($arrTmp as $item) {
                        $redis->hSet($campConvKey, $item['id'], $item['id']);
                        if (!empty($arrCampConv[$item['id']])) {
                            unset($arrCampConv[$item['id']]);
                        }
                    }
                    if (!empty($arrCampConv)) {
                        foreach ($arrCampConv as $key => $val) {
                            $redis->hdel($campConvKey, $key);
                        }
                    }
                }
            }
            if (!empty($arrCampaign)) {
                foreach ($arrCampaign as $id => $campaign) {
                    $redis->hdel($cacheKey, $id);
                    $redis->del("CampConv_{$id}");
                }
            }
            break;
        case 'Flight':
            $redis = new Redis();
            $redis->connect(REDIS_HOST, REDIS_PORT_1);
            $cacheKey = 'Flight';
            $arrFlight = $redis->hgetall($cacheKey);
            foreach ($arrData as $data) {
                if (!empty($data)) {
                    //print_r($data);
                    $data['country'] = json_decode($data['country']);
                    $data['province'] = json_decode($data['province']);
                    $redis->hset($cacheKey, $data['id'], json_encode($data));
                    unset($arrFlight[$data['id']]);
                }
            }
            if (!empty($arrFlight)) {
                foreach ($arrFlight as $id => $flight) {
                    $redis->hdel($cacheKey, $id);
                }
            }
            break;
        case 'Adzone':
            $redis = new Redis();
            $redis->connect(REDIS_HOST, REDIS_PORT_1);
            $servername = DB_HOST . ":" . DB_PORT;
            $username = DB_USERNAME;
            $password = DB_PASSWORD;
            $dbname = DB_NAME;
            $cacheKey = 'Adzone';
            $arrAdzone = $redis->hgetall($cacheKey);
            $conn = new mysqli($servername, $username, $password, $dbname);
            // Check connection
            if ($conn->connect_error) {
                die("Connection failed: " . $conn->connect_error);
            }
            $sql = '';
            foreach ($arrData as $data) {
                if (!empty($data)) {
                    //print_r($data);
                    $publisher_site_id = $data['publisher_site_id'];
                    $sql = <<<EOF
                    SELECT url
                    FROM pt_publisher_site
//.........这里部分代码省略.........
开发者ID:huycao,项目名称:yoplatform,代码行数:101,代码来源:data.php

示例10: hgetall

 /**
  * Increment a raw value
  *
  * @param	string	$id	Cache ID
  * @param	int	$offset	Step/value to add
  * @return	mixed	New value on success or FALSE on failure
  */
 public function hgetall($alias)
 {
     return $this->_redis->hgetall($alias);
 }
开发者ID:asmenglei,项目名称:lanxiao,代码行数:11,代码来源:Cache_redis.php

示例11: rand

echo "<pre>";
print_r($data);
$redis->zrem("zset", 456);
echo $redis->zcount("zset", 10, 50);
$redis->zRemRangeByScore("key", star, end);
echo $redis->zScore("zset", 503);
echo $redis->zrank("zset", 723);
for ($i = 0; $i < 10; $i++) {
    $redis->hset("myhash", $i, rand(10, 99) + $i);
}
echo $redis->hget("myhash", "0");
echo $redis->hlen("myhash");
echo $redis->hdel("myhash", "0");
$data = $redis->hkeys("myhash");
$data = $redis->hvals("myhash");
$data = $redis->hgetall("myhash");
echo "<pre>";
print_r($data);
echo $redis->hexists("myhash", "0");
$redis->hmset("user:1", array("name1" => "name1", "name2" => "Joe2"));
$data = $redis->hmget("user:1", array('name', 'salary'));
print_r($data);
// redis
$redis->move("key1", 2);
$redis->settimeout("user:1", 10);
$redis->expireat("myhash", time() + 23);
$count = $redis->dbSize();
$redis->auth("foobared");
$redis->bgrewriteaof();
$redis->slaveof("10.0.1.7", 6379);
print_r($redis->info());
开发者ID:isS,项目名称:NoSQL,代码行数:31,代码来源:redisWithPHP.php

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

示例13: mbr

 public function mbr()
 {
     $this->pData = checkData($_POST);
     $this->gData = checkData($_GET);
     $this->pData['orderField'] = $orderField = isset($this->pData['orderField']) ? $this->pData['orderField'] : 'tdate';
     $this->pData['orderDirection'] = $orderDirection = isset($this->pData['orderDirection']) ? $this->pData['orderDirection'] : 'desc';
     $this->orderField = $orderField;
     $this->orderDirection = $orderDirection;
     $s_date = $this->pData['s_date'];
     $e_date = isset($this->pData['e_date']) ? $this->pData['e_date'] : date("Y-m-d");
     $this->pData['s_date'] = $s_date;
     $this->pData['e_date'] = $e_date;
     $date = date("Y-m-d", time());
     $hash = "mbr_" . $date;
     $redis = new Redis();
     $redis->connect('192.168.0.15', 6379);
     $install_all = $redis->hLen("install");
     //总安装量
     //print_r($install_all);die;
     $data[] = $redis->hgetall("mbr");
     $value = array();
     foreach ($data as $k => $v) {
         foreach ($v as $key => $val) {
             $value[] = json_decode($val);
         }
     }
     if ($e_date) {
         for ($i = 0; $i < count($value); $i++) {
             if ($value[$i][3] <= $e_date) {
                 $values[] = $value[$i];
             }
         }
     } else {
         if ($s_date) {
             for ($i = 0; $i < count($value); $i++) {
                 if ($value[$i][3] >= $s_date) {
                     $values[] = $value[$i];
                 }
             }
         } else {
             if (isset($e_date) && isset($s_date)) {
                 for ($i = 0; $i < count($value); $i++) {
                     if ($value[$i][3] >= $s_date && $value[$i][3] <= $e_date) {
                         $values[] = $value[$i];
                     }
                 }
             } else {
                 for ($i = 0; $i < count($value); $i++) {
                     $values[] = $value[$i];
                 }
             }
         }
     }
     for ($i = 0; $i < count($values); $i++) {
         unset($values[$i][2]);
         $value_str[] = implode(",", $values[$i]);
     }
     $arr = array_unique($value_str);
     foreach ($arr as $k => $v) {
         $value_arr[] = $v;
     }
     for ($i = 0; $i < count($value_arr); $i++) {
         $value_a[] = explode(",", $value_arr[$i]);
     }
     //print_r($value_a);die;
     $this->s->assign('count', 5);
     $this->s->assign('install_all', $install_all);
     $this->s->assign('data', $value_a);
     $this->s->assign('total', count($value_a));
     $this->s->assign('search', $this->pData);
 }
开发者ID:13240361944,项目名称:analyze,代码行数:71,代码来源:wapDataAction.class.php

示例14: strtolower

 $bid = $row[1];
 $ver = $row[2];
 $deviceType = strtolower($row[3]);
 $did = $didInfo[$deviceType] + 0;
 $time = $row[4];
 $ptype = $row[5];
 $broken = $row[6];
 $qd = $row[7];
 $remoteIp = $row[8];
 if ($ptype != 1 && $ptype != 2) {
     $count++;
 }
 $ipStr = long2ip($remoteIp);
 //设备激活时间
 $deviceKey = 'wap#' . $idfa . '_' . $bid;
 $deviceInfo = $redis->hgetall($deviceKey);
 $addTime = $deviceInfo['addTime'];
 $kid = $deviceInfo['kid'] ? $deviceInfo['kid'] : 0;
 $adid = $deviceInfo['adid'] ? $deviceInfo['adid'] : 0;
 if (!$addTime || $addTime > $maxTime) {
     echo $addTime, PHP_EOL;
     $addTime = $time;
     $info['id'] = $idfa;
     $info['addTime'] = $addTime;
     $info['bid'] = $bid;
     $info['firstLogin'] = $calDateUnix;
     $redis->hMset($deviceKey, $info);
 }
 if ($addTime >= $calDateUnix) {
     $newFlag = 1;
 } else {
开发者ID:13240361944,项目名称:analyze,代码行数:31,代码来源:wap_app_day.php

示例15: all

 /**
  * @inheritdoc
  */
 public function all($id)
 {
     return array_map(function ($val) {
         return json_decode($val, true);
     }, $this->redis->hgetall($id));
 }
开发者ID:mvanduijker,项目名称:FMIoBundle,代码行数:9,代码来源:RedisItemLogger.php


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