ip 请求次数限制13

This commit is contained in:
GYJ 2025-03-24 10:03:56 +08:00
parent de8385b8ca
commit 562f23759e
1 changed files with 25 additions and 23 deletions

View File

@ -58,6 +58,7 @@ public class IpAccessCounter {
// }
public static void removeOldInfo() {
synchronized (IpAccessCounter.class) {
try {
removeCount.set(0);
long currentTime = System.currentTimeMillis();
@ -85,6 +86,7 @@ public class IpAccessCounter {
log.error("定时任务异常", e);
}
}
}
// 检查 IP 是否可以访问
public static boolean canAccess(String ip, Integer maxAccessCount) {