View Source SauceAnalytics.Store (sauce_analytics v0.1.1)
Session store for analytics information, uses an ETS as a backend for the data.
options
Options
:table_name
- The name of the table that the ETS will use. Defaults to:sauce_analytic_session_table
:session_max_age
- The number of seconds before a session in the Store is considered expired. Defaults to3600
(1 hour):clean_interval
- The number of seconds that specify the period of time between each clean up of expired sessions. Defaults to5400
(1.5 hours)
Link to this section Summary
Functions
Assigns a user to a session in the Store.
Returns a specification to start this module under a supervisor.
Returns the state/configuration of the SauceAnalytics.Store
GenServer.
Increments view_sequence or event_sequence on a session in the Store.
Returns a session in the Store.
If the session referenced in revive_session
does not exist, the session will be revived.
Creates a new session in the Store.
Revives a previously expired and deleted session in the Store.
Returns true if a session exists in the Store, false otherwise.
Starts the Store GenServer with the given opts
.
Link to this section Types
Link to this section Functions
Assigns a user to a session in the Store.
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec get_state() :: SauceAnalytics.Store.State.t()
Returns the state/configuration of the SauceAnalytics.Store
GenServer.
@spec inc_sequence(session_id :: reference(), type :: :view | :event) :: :ok | {:error, :not_found}
Increments view_sequence or event_sequence on a session in the Store.
type
can either be :view
or :event
@spec lookup_session(session_id :: reference()) :: {:ok, SauceAnalytics.Store.Session.t()} | {:error, :not_found}
Returns a session in the Store.
@spec maybe_revive_session(revive_session :: SauceAnalytics.ReviveSession.t()) :: SauceAnalytics.Store.Session.t()
If the session referenced in revive_session
does not exist, the session will be revived.
Creates a new session in the Store.
@spec revive_session(revive_session :: SauceAnalytics.ReviveSession.t()) :: SauceAnalytics.Store.Session.t()
Revives a previously expired and deleted session in the Store.
Given a SauceAnalytics.ReviveSession
struct a session can be generated which
contains the same session_id that the client expects.
Returns true if a session exists in the Store, false otherwise.
@spec start_link([opts()]) :: GenServer.on_start()
Starts the Store GenServer with the given opts
.
Use this in your application supervision tree.