plug_attack v0.4.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}
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor
Forcefully clean the storage
Implementation for the PlugAttack.Storage.increment/4 callback
Implementation for the PlugAttack.Storage.read/3 callback
Implementation for the PlugAttack.Storage.read_sliding_counter/3 callback
Starts the storage table and cleaner process
Implementation for the PlugAttack.Storage.write/4 callback
Implementation for the PlugAttack.Storage.write_sliding_counter/3 callback
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Forcefully clean the storage.
Implementation for the PlugAttack.Storage.increment/4 callback.
Implementation for the PlugAttack.Storage.read/3 callback.
Implementation for the PlugAttack.Storage.read_sliding_counter/3 callback.
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).
Implementation for the PlugAttack.Storage.write/4 callback.
Implementation for the PlugAttack.Storage.write_sliding_counter/3 callback.