Class RateLimit
-
- All Implemented Interfaces:
public final class RateLimitRate limiting which works as follows:
must be at least defaultMinInterval gap between the requests
no more than maxRequests requests within the interval
-
-
Method Summary
Modifier and Type Method Description final Booleanaccept(Instant now, Duration minInterval)Return true if the request should be accepted and false otherwise. final Booleanaccept(Instant now)Return true if the request should be accepted and false otherwise. final Booleanaccept()Return true if the request should be accepted and false otherwise. -
-
Method Detail
-
accept
@JvmOverloads() final Boolean accept(Instant now, Duration minInterval)
Return true if the request should be accepted and false otherwise. now is the current time, if not provided clock.instant() is used. minInterval can be specified per accept call to support varying minimum intervals (e.g., based on round-trip times).
-
accept
@JvmOverloads() final Boolean accept(Instant now)
Return true if the request should be accepted and false otherwise. now is the current time, if not provided clock.instant() is used. minInterval can be specified per accept call to support varying minimum intervals (e.g., based on round-trip times).
-
accept
@JvmOverloads() final Boolean accept()
Return true if the request should be accepted and false otherwise. now is the current time, if not provided clock.instant() is used. minInterval can be specified per accept call to support varying minimum intervals (e.g., based on round-trip times).
-
-
-
-