Kota (kota v0.1.1)

View Source

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

await(server, timeout \\ :infinity)

cancel(server, ref)

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

now_ms()

start(opts)

start_link(opts)

stop(server)

total_count(server)