Atex.OAuth.SessionStore.DETS (atex v0.7.1)

View Source

DETS implementation for Atex.OAuth.SessionStore.

This is recommended for single-node production deployments, as sessions will persist on disk between application restarts. For more complex, multi-node deployments, consider making a custom implementation using Redis or some other distributed store.

Configuration

By default the DETS file is stored at priv/dets/atex_oauth_sessions.dets relative to where your application is running. You can configure the file path in your config.exs:

config :atex, Atex.OAuth.SessionStore.DETS,
  file_path: "/var/lib/myapp/sessions.dets"

Parent directories will be created as necessary if possible.

Summary

Functions

Returns a specification to start this module under a supervisor.

Delete a session from the DETS table.

Retrieve a session from the DETS table.

Insert a session into the DETS table.

Update a session in the DETS table.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

delete(key)

@spec delete(String.t()) :: :ok | :error | :noop

Delete a session from the DETS table.

Returns :ok if deleted, :noop if the session didn't exist.

get(key)

@spec get(String.t()) :: {:ok, Atex.OAuth.Session.t()} | {:error, atom()}

Retrieve a session from the DETS table.

Returns {:ok, session} if found, {:error, :not_found} otherwise.

insert(key, session)

@spec insert(String.t(), Atex.OAuth.Session.t()) :: :ok | {:error, atom()}

Insert a session into the DETS table.

Returns :ok on success, {:error, reason} if an unexpected error occurs.

start_link(opts)

update(key, session)

@spec update(String.t(), Atex.OAuth.Session.t()) :: :ok | {:error, atom()}

Update a session in the DETS table.

In DETS, this is the same as insert - it replaces the existing entry.