ip(); $this->key = $this->tagName . $ip; } /** * @notes 记录登录错误次数 * @author 令狐冲 * @date 2021/6/30 01:51 */ public function record() { if ($this->get($this->key)) { //缓存存在,记录错误次数 $this->inc($this->key, 1); } else { //缓存不存在,第一次设置缓存 $this->set($this->key, 1, $this->minute * 60); } } /** * @notes 判断是否安全 * @return bool * @author 令狐冲 * @date 2021/6/30 01:53 */ public function isSafe() { $count = $this->get($this->key); if ($count >= $this->count) { return false; } return true; } /** * @notes 删除该ip记录错误次数 * @author 令狐冲 * @date 2021/6/30 01:55 */ public function relieve() { $this->delete($this->key); } }