plug_attack v0.4.0 PlugAttack.Storage behaviour

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

Link to this type key()
key() :: term()
Link to this type opts()
opts() :: term()

Time of milliseconds since unix epoch.

Link to this section Callbacks

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