Sliding Window Rate Limiter
Sliding window rate limiter implementation.
Unlike token bucket, this tracks requests within a time window and rejects requests if the limit is exceeded within that window.
Use Cases:
Strict rate limiting (e.g., "max 100 requests per minute")
Time-based quotas
More predictable rate limiting than token bucket
Parameters
config
Configuration for sliding window rate limiter
Example usage:
val rateLimiter = SlidingWindowRateLimiter.create(
config = SlidingWindowConfig(
maxRequests = 100,
windowDuration = 1.minutes
)
)Content copied to clipboard
Types
Link copied to clipboard
object Companion
Factory for SlidingWindowRateLimiter.
Functions
Inherited functions
Link copied to clipboard
Adapts this SlidingWindowRateLimiter into a Policy.