plug_session_mnesia v0.1.2 PlugSessionMnesia.Cleaner View Source

A module to clean inactive sessions.

Link to this section Summary

Functions

Cleans inactive sessions

Starts the session cleaner

Link to this section Functions

Link to this function clean_sessions(table, max_age) View Source
clean_sessions(atom(), pos_integer()) ::
  :ok |
  {:error | :aborted, term()}

Cleans inactive sessions.

Parameters

  • table - Mnesia table where sessions are stored
  • max_age - maximum age for sessions in seconds

Example

iex> PlugSessionMnesia.clean_sessions(:session, 86400)
:ok
Link to this function start_link(args \\ nil) View Source
start_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.