ip 请求次数限制13

This commit is contained in:
GYJ
2025-03-24 10:03:56 +08:00
parent de8385b8ca
commit 562f23759e

View File

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