limiter v0.1.2 Limiter
Rate limiter implementation based on Generic Cell Rate Algorithm (GCRA).
The limiter checks if a given key exceeded a rate limit and returns the result with additional info.
For more details, see the below links:
Example usage:
Limiter.checkout({Limiter.Storage.ConCache, :storage}, "key", 10_000, 5)
Summary
Types
The key associated with an action which is rate limited
The number of actions (in case the quantity
is 1
) that along with
the period
defines the rate limit
The period of time that along with limit
defines the rate limit
The weight of an action. Typically it’s set to 1
. The more expensive
actions may use greater value
Tuple that contains the module used for storage and options for the given storage
Storage module that implements Limiter.Storage
behaviour
Options for a storage module. These options may differ for different storage implementations
Functions
Checks if an action associated with a key is allowed
Resets the value associated with the key
Types
The number of actions (in case the quantity
is 1
) that along with
the period
defines the rate limit.
The weight of an action. Typically it’s set to 1
. The more expensive
actions may use greater value.
Tuple that contains the module used for storage and options for the given storage.
Storage module that implements Limiter.Storage
behaviour.