plug_session_mnesia v0.1.3 PlugSessionMnesia.Cleaner View Source
A module to clean inactive sessions.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Cleans inactive sessions.
Starts the session cleaner.
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Link to this function
clean_sessions(table, max_age)
View Sourceclean_sessions(atom(), pos_integer()) :: :ok | {:error | :aborted, term()}
Cleans inactive sessions.
Parameters
table- Mnesia table where sessions are storedmax_age- maximum age for sessions in seconds
Example
iex> PlugSessionMnesia.clean_sessions(:session, 86400)
:ok
Link to this function
start_link(args \\ nil)
View Sourcestart_link(term()) :: GenServer.on_start()
Starts the session cleaner.
:table and :max_age must be provided in the application configuration for
this function to work:
config :plug_session_mnesia,
table: :session,
max_age: 86_400
Returns {:error, :bad_configuration} otherwise.