Macaw.Plug.RateLimit.Table (macaw_plug v0.1.4)

Copy Markdown View Source

Owns Macaw.Plug.RateLimit's ETS table and sweeps it.

A key whose theoretical arrival time has passed has its full burst again, so it is the same as an absent key, and the sweep deletes it. The sweep runs every :sweep_every milliseconds (default one minute).

Summary

Functions

Returns a specification to start this module under a supervisor.

Deletes every key idle at now (monotonic microseconds); returns how many.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts \\ [])

sweep(now \\ System.monotonic_time(:microsecond))

@spec sweep(integer()) :: non_neg_integer()

Deletes every key idle at now (monotonic microseconds); returns how many.