protected function _limit($id, $resource, $duration, $times)
{
$key = $this->_prefix . $id . ':' . $resource;
$current_times = $this->redis->incr($key);
if ($current_times === 1) {
$this->redis->setTimeout($key, $duration);
}
return $times >= $current_times;
}