plug_attack v0.3.0 PlugAttack.Storage behaviour

Behaviour for the storage backend for various rules.

Summary

Types

Time of milliseconds since unix epoch

Types

key()
key() :: term
opts()
opts() :: term
time()
time() :: non_neg_integer

Time of milliseconds since unix epoch.

Callbacks

increment(opts, key, inc, expires_at)
increment(opts, key, inc :: integer, expires_at :: time) :: integer
read(opts, key, now)
read(opts, key, now :: time) :: {:ok, term} | :error
read_sliding_counter(opts, key, now)
read_sliding_counter(opts, key, now :: time) :: non_neg_integer
write(opts, key, value, expires_at)
write(opts, key, value :: term, expires_at :: time) :: :ok
write_sliding_counter(opts, key, now, expires_at)
write_sliding_counter(opts, key, now :: time, expires_at :: time) :: :ok