module RateLimiter
Overview
Rate limiting functionality.
Defined in:
rate_limiter.crConstant Summary
-
VERSION =
"1.0.1"
Constructors
-
.new(rate : Float64, max_burst : Int32 = 1)
Creates a new
Limiter
. -
.new(interval : Time::Span, max_burst : Int32 = 1)
Creates a new
Limiter
. -
.new(*limiters : Limiter)
Creates a
MultiLimiter
.
Constructor Detail
def self.new(rate : Float64, max_burst : Int32 = 1)
#
Creates a new Limiter
.
rate
: the rate of tokens being produced in tokens/second.
max_burst
: maximum number of tokens that can be stored in the bucket.
def self.new(interval : Time::Span, max_burst : Int32 = 1)
#
Creates a new Limiter
.
interval
: the interval at which new tokens are generated.
max_burst
: maximum number of tokens that can be stored in the bucket.
Creates a MultiLimiter
.
limiters
: a set of rate limiters.