function circuitBreaker($count, $limitTime = 60)
{
$redisKey = "test_redis";
$currentTime = time();
$length = $this->redis->lPush($redisKey, $currentTime);
// 避免只入不出, 削个峰
if ($length >= $count) {
if ($length > $count * 1.5) {
$this->redis->lTrim($redisKey, 0, $count - 1);
}
$previousTime = $this->redis->rPop($redisKey);
if ($previousTime && ($currentTime - $previousTime <= $limitTime)) {
return true;
}
}
return false;
}