View Source Kota (kota v0.1.0)
Kota is a simple rate limiter.
Basic example
{:ok, kota} = Kota.start_link(max_allow: 10, range_ms: 1000, adapter: Kota.Bucket.DiscreteCounter)
:ok = Kota.await(kota)
Adapters
Kota.Bucket.DiscreteCounter
– This adapter just counts every call at the expense of memory usage.Kota.Bucket.SlidingWindow
– This adapter uses a sliding window technique to save on memory and processing but will result in a lower rate if used constantly without time to recover time lost by the window timespan.
Summary
Functions
Returns a specification to start this module under a supervisor.