// 判断key是否存在
$check = $this->redis->exists('qps_' . $appid);
if ($check){
// +1
$this->redis->incr('qps_' . $appid);
$count = $this->redis->get('qps_' . $appid);
// 限制每分钟30次
if($count > 30){
Help::print_json(100, '当前appid请求频率过高');
}
} else {
$this->redis->set('qps_' . $appid, 1);//初始值1
$this->redis->expire('qps_' . $appid, 60);//有效期一分钟
}
01-19
550
博客
京东医疗器械分类汇总
09-21
181
09-18
2833
09-18
709
09-18
864
12-13
1832
11-25
1855
博客
PHP根据经纬度得到城市
11-25
1182
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交