PlugAttack.Storage behaviour (plug_attack v0.4.3)

Behaviour for the storage backend for various rules.

Link to this section Summary

Types

Time of milliseconds since unix epoch.

Link to this section Types

Specs

key() :: term()

Specs

opts() :: term()

Specs

time() :: non_neg_integer()

Time of milliseconds since unix epoch.

Link to this section Callbacks

Link to this callback

increment(opts, key, inc, expires_at)

Specs

increment(opts(), key(), inc :: integer(), expires_at :: time()) :: integer()
Link to this callback

read(opts, key, now)

Specs

read(opts(), key(), now :: time()) :: {:ok, term()} | :error
Link to this callback

read_sliding_counter(opts, key, now)

Specs

read_sliding_counter(opts(), key(), now :: time()) :: non_neg_integer()
Link to this callback

write(opts, key, value, expires_at)

Specs

write(opts(), key(), value :: term(), expires_at :: time()) :: :ok
Link to this callback

write_sliding_counter(opts, key, now, expires_at)

Specs

write_sliding_counter(opts(), key(), now :: time(), expires_at :: time()) :: :ok