module RateLimiter::LimiterLike

Overview

Defines the API for a rate-limiter-like instance.

Direct including types

Defined in:

rate_limiter.cr

Instance Method Summary

Instance Method Detail

abstract def get(max_wait : Time::Span) : Token | Timeout #

Returns a Token if one is available within max_wait time, otherwise it returns a Timeout. Blocking.


[View source]
abstract def get : Token #

Returns a Token as soon as available. Blocking.


[View source]
def get!(max_wait : Time::Span) : Token #

Raises RateLimiter::Timeout if no token is available after the given time span. Blocking for at most a max_wait duration.


[View source]
def get! : Token #

Raises RateLimiter::Timeout if no token is available at call time. Non-blocking.


[View source]
def get? : Token | Nil #

Returns nil if no token is available at call time. Non-blocking.


[View source]