plug_attack v0.1.0 PlugAttack.Storage.Ets

Storage solution for PlugAttack using a local ets table.

Usage

You need to start the process in your supervision tree, for example:

children = [
  # ...
  worker(PlugAttack.Storage.Ets, [MyApp.PlugAttackStorage])
]

This will later allow you to pass the :storage option to various rules as storage: {PlugAttack.Ets, MyApp.PlugAttackStorage}

Summary

Functions

Implementation for the PlugAttack.Storage.increment/4 callback

Starts the storage table and cleaner process

Functions

increment(name, key, inc, expires_at)

Implementation for the PlugAttack.Storage.increment/4 callback

start_link(name, opts \\ [])

Starts the storage table and cleaner process.

The process is registered under name and a public, named ets table with that name is created as well.

Options

  • :clean_period - how often the ets table should be cleaned of stale data. The key scheme guarantees stale data won’t be used for making decisions. This is only about limiting memory consumption (default: 5000 ms).