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


PHP Redis::hget方法代码示例

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


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

示例1: isCached

 protected function isCached(Bookmark $bookmark, $redisKey)
 {
     if ($this->redis !== null) {
         return $this->redis->hget($redisKey, $bookmark->url);
     }
     return false;
 }
开发者ID:nickel715,项目名称:pinboard-archive,代码行数:7,代码来源:WaybackMachine.php

示例2: setting

 /**
  * Get or set setting
  *
  * @param string     $name
  * @param string|int $value
  * @return mixed
  */
 public function setting($name, $value = null)
 {
     if ($value) {
         $this->client->hset('q:settings', $name, $value);
         return $this;
     }
     return $this->client->hget('q:settings', $name);
 }
开发者ID:coderofsalvation,项目名称:php-kue,代码行数:15,代码来源:Kue.php

示例3: Redis

<?php

header("Content-Type: text/html;charset=utf-8");
$cookie = $_POST["Cookie"];
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
if (strpos($cookie, "DedeUserID") === FALSE or strpos($cookie, "DedeUserID__ckMd5") === FALSE or strpos($cookie, "SESSDATA") === FALSE) {
    echo "<script>alert('Cookie数据不符合要求,请重试!');history.go(-1);</script>";
    exit;
}
$keyname = preg_replace('{(.*)?DedeUserID=([\\d]+);(.*)?}', '$2', $cookie);
if ($redis->exists($keyname)) {
    $status = $redis->hget($keyname, 'status');
    $cookieexist = $redis->hget($keyname, 'cookie');
    if ($status == 'processing') {
        echo "<script>alert('正在为你领取银瓜子~');history.go(-1);</script>";
        exit;
    } elseif ($status == 'processed') {
        echo "<script>alert('今天的银瓜子已经领完了,明天再来吧~');history.go(-1);</script>";
        exit;
    } elseif ($status == 'problem') {
        if ($cookieexist == $cookie) {
            echo "<script>alert('Cookie数据有问题,请尝试重新登录获取后再提交!');history.go(-1);</script>";
            exit;
        } else {
            echo "<script>alert('成功更新Cookie数据!');</script>";
        }
    } else {
        echo "<script>alert('你的任务正在队列中,稍后再看看吧~');history.go(-1);</script>";
        exit;
    }
开发者ID:nasrudin1996,项目名称:fuckbilibili.github.io,代码行数:31,代码来源:get.php

示例4: Redis

$log->info("Starting feedwriter process");
// Connect to redis
$redis = new Redis();
while (!$redis->connect("127.0.0.1")) {
    sleep(1);
    $log->warn("Could not connect to redis, retrying");
}
require "Modules/feed/engine/PHPTimeSeries.php";
require "Modules/feed/engine/PHPFina.php";
$engine = array();
$engine[Engine::PHPTIMESERIES] = new PHPTimeSeries($feed_settings['phptimeseries']);
$engine[Engine::PHPFINA] = new PHPFina($feed_settings['phpfina']);
while (true) {
    $len = $redis->llen("feedbuffer");
    for ($i = 0; $i < $len; $i++) {
        $f = explode(",", $redis->lpop("feedbuffer"));
        $feedid = $f[0];
        $timestamp = $f[1];
        $value = $f[2];
        $padding_mode = (int) $f[3];
        $e = $redis->hget("feed:{$feedid}", 'engine');
        if ($padding_mode == 1) {
            $engine[Engine::PHPFINA]->padding_mode = 'join';
        }
        $engine[$e]->prepare($feedid, $timestamp, $value);
        $engine[Engine::PHPFINA]->padding_mode = 'nan';
    }
    $log->info("PHPTimeSeries bytes written: " . $engine[Engine::PHPTIMESERIES]->save());
    $log->info("PHPFina bytes written: " . $engine[Engine::PHPFINA]->save());
    sleep(60);
}
开发者ID:roy13,项目名称:EMON,代码行数:31,代码来源:feedwriter.php

示例5: hget

 public function hget($prefix, $key)
 {
     $data = unserialize(parent::hget($this->generateUniqueKey($prefix), $key));
     if (!is_array($data)) {
         return false;
     }
     if (isset($data[1]) && (!$data[1] instanceof ICacheDependency || !$data[1]->getHasChanged())) {
         return $data[0];
     }
     return false;
 }
开发者ID:nbaiwan,项目名称:yav,代码行数:11,代码来源:CRedis.php

示例6: hget

 /**
  * 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 hget($alias, $key)
 {
     return $this->_redis->hget($alias, $key);
 }
开发者ID:asmenglei,项目名称:lanxiao,代码行数:11,代码来源:Cache_redis.php

示例7: count

//同一个文件服务安装的次数
foreach ($res as $k => $v) {
    for ($i = 0; $i < count($v); $i++) {
        $arr_num[$k] = count($v);
        $cont[] = count($v) . ',' . $k . ',' . $v[$i][1] . ',' . $date;
    }
}
//print_r($cont);die;
for ($i = 0; $i < count($cont); $i++) {
    $cont_arr[] = explode(",", $cont[$i]);
}
//print_r($cont_arr);die;
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
foreach ($cont_arr as $key => $val) {
    $vals[] = $redis->hget("server", $val[2]);
    if ($vals) {
        $redis->hdel("server", $val[2]);
        $redis->hset("server", $val[2], json_encode($val));
    } else {
        $redis->hset("server", $val[2], json_encode($val));
    }
}
//print_r($redis->hGetAll("server"));die;
/*
 * Mbr 日 启 动 统 计
 */
//信息分割成数组
for ($i = 0; $i < count($install); $i++) {
    $info_arr[] = explode(",", $install[$i]);
}
开发者ID:13240361944,项目名称:analyze,代码行数:31,代码来源:analyze.php

示例8: hget

 public function hget($key, $hash, $serialize = true)
 {
     return $serialize ? unserialize($this->handler->hget($key, $hash)) : $this->handler->hget($key, $hash);
 }
开发者ID:billge1205,项目名称:biny,代码行数:4,代码来源:TXRedis.php

示例9: rand

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>";
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);
开发者ID:isS,项目名称:NoSQL,代码行数:31,代码来源:redisWithPHP.php

示例10: get

 /**
  * Get job property
  *
  * @param string $key
  * @return mixed
  */
 public function get($key)
 {
     return $this->client->hget('q:job:' . $this->injectors['id'], $key);
 }
开发者ID:coderofsalvation,项目名称:php-kue,代码行数:10,代码来源:Job.php

示例11: array

            $users[] = $u;
        }
        //设置当前用户信息
        $redis->hMset("chatuser:{$sid}", array("name" => $info['name'], 'id' => $sid));
        //返回用户列表
        $body = json_encode(array('type' => 'list', 'list' => $users));
        header("Content-Length: " . strlen($body));
        echo $body;
    } else {
        if ($info['type'] == 'join') {
            //加入分组
            $router->addChannel('chat-channel-' . $info['channel'], $sid);
        } else {
            if ($info['type'] == 'msg') {
                //发送消息
                $name = $redis->hget("chatuser:{$sid}", "name");
                $info['text'] = str_replace(array('<', '>'), array('&lt;', '&gt;'), $info['text']);
                if ($info['channel']) {
                    $router->publish('chat-channel-' . $info['channel'], json_encode(array('type' => 'msg', 'name' => $name, 'channel' => (int) $info['channel'], 'text' => $info['text'], 'time' => date('i:s'))));
                } else {
                    $router->sendAllMsg(json_encode(array('type' => 'msg', 'name' => $name, 'channel' => 0, 'text' => $info['text'], 'time' => date('i:s'))));
                }
            }
        }
    }
} else {
    if ($_SERVER['EVENT'] == 2) {
        //断开连接
        $user = $redis->hgetall("chatuser:{$sid}");
        if ($user) {
            $redis->del("chatuser:{$sid}");
开发者ID:eastlhu,项目名称:fooking,代码行数:31,代码来源:gateway.php


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