phpRedisAdmin安装

phpRedisAdmin是一个用php管理redis的工具, 和phpmyadmin类似.

1. 下载phpRedisAdmin

cd /usr/local/httpd-2.4.1/htdocs

wget https://nodeload.github.com/ErikDubbelboer/phpRedisAdmin/zipball/master

mv master phpRedisAdmin.zip

unzip phpRedisAdmin.zip

2. 配置和测试.

cd phpRedisAdmin/

vi config.inc.php

# 修改redis服务器配置, 可以配置多个redis服务器

# 也可以配置登录认证

 

3. 数据量过大bug处理.

对于数据量较大的redis(50w数量级)来说, 页面加载的时候会非常慢, 而且显示50w的数据也是没有意义的.

数据量过多, 就需要用到搜索了.

可以设置一个key值显示阈值, 如果超过该阈值, 不再显示.

修改config.inc.php:  // 配置文件中增加显示阈值

vi config.inc.php

<?php
// 最多显示50个
$config['maxkeydisno'] = 50;
?>

vi index.php

修改index.php:

<?php
function print_namespace($item, $name, $fullkey, $islast) {
if (count($item) > 0) {
?>
<li class="folder<?php echo empty($fullkey) ? '' : ' collapsed'?><?php echo $islast ? ' last' : ''?>">
<div class="icon"><?php echo format_html($name)?>&nbsp;
<span class="info">(<?php echo count($item)?>)</span>
<?php if (!empty($fullkey)) { ?><a href="delete.php?s=<?php echo $server['id']?>&amp;tree=<?php echo urlencode($fullkey)?>:" class="deltree"><img src="images/delete.png" width="10" height="10" title="Delete tree" alt="[X]"></a><?php } ?>
</div>
<ul>
<?php
$l = count($item);
// +++ edit here: set a var to count the key number
$subkeycount = 0;
foreach ($item as $childname => $childitem) {
// $fullkey will be empty on the first call.
if (empty($fullkey)) {
$childfullkey = $childname;
} else {
$childfullkey = $fullkey.$config['seperator'].$childname;
}
// +++ add here: if keycount more than the config maxno, just give tips and exit the loop
if ($subkeycount > $config['maxkeydisno']) {
echo "<li class='last'>*too many data,please filter it*</li>";
break;
}
print_namespace($childitem, $childname, $childfullkey, (--$l == 0));
$temp ++;
}
?>
</ul>
<?php
}
}
?>


当然, 这是一个临时的解决方法, 更完善的方法需要通读代码.

 

参考资料:

https://github.com/ErikDubbelboer/phpRedisAdmin

转载于:https://www.cnblogs.com/DavidYan/articles/2384001.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值