Class RateLimitService
java.lang.Object
org.tavall.couriers.api.web.service.utils.RateLimitService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanChecks if a client is allowed to proceed based on a cooldown.
-
Constructor Details
-
RateLimitService
public RateLimitService()
-
-
Method Details
-
isAllowed
Checks if a client is allowed to proceed based on a cooldown.- Parameters:
clientIp- The IP address of the caller.cooldownMs- The required wait time in milliseconds.- Returns:
- true if they can proceed, false if they're spamming.
-
clearOldRecords
public void clearOldRecords()
-