View Source EctoSessions.ExpiredSessionPruner (Ecto Sessions v0.3.0)
GenServer implementation to delete expired sessions periodically. Given an EctoSessions module
and periodicity, in milliseconds.
usage
Usage
In your project's
application.ex:def start(_type, _args) do children = [ # ... {EctoSessions.ExpiredSessionPruner, {YourSessionsModule, :timer.hours(24)}} ] opts = [strategy: :one_for_one, name: EctoSessionsDemo.Supervisor] Supervisor.start_link(children, opts) endLow level usage with
start_link:GenServer.start_link( EctoSessions.ExpiredSessionPruner, {YourSessionsModule, 10_000} )
Where YourSessionsModule is any module that uses EctoSessions and the second argument the
number of milliseconds to 'sleep' between cycles. Ex: 12 * 60 * 60 * 1000 for 12h. Use :timer
for readability.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Callback implementation for GenServer.init/1.
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Callback implementation for GenServer.init/1.