Interface RateLimitDecision
- All Known Implementing Classes:
RateLimitDecision.Allowed, RateLimitDecision.Throttled
@ExperimentalJSentinelApi
public sealed interface RateLimitDecision
permits RateLimitDecision.Allowed, RateLimitDecision.Throttled
Result of a
RateLimitPolicy.tryAcquire(RateLimitKey) call.
Sealed because adapters dispatch on the two outcomes — let the
request through or refuse it with a 429 Too Many
Requests (REST) / equivalent rejection (UI).
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordThe event was admitted; the caller proceeds.static final recordThe event was refused — the per-window count is already at or above the configured limit. -
Method Summary
-
Method Details
-
eventsInWindow
int eventsInWindow()- Returns:
- the per-window event count after this decision (used / observed)
-
limit
int limit()- Returns:
- the configured per-window limit
-
window
Duration window()- Returns:
- the configured window duration
-