Mnemonix v0.10.0 Plug.Session.MNEMONIX View Source
Stores the session in a store.
This store does not create the Mnemonix store; it expects that a reference to an existing store server is passed in as an argument.
We recommend carefully choosing the store type for production usage. Consider: persistence, cleanup, and cross-node availability.
Options
:store
-Mnemonix.store/0
reference (required)
Examples
# Start a named store when the application starts
Mnemonix.Stores.Map.start_link(server: [name: My.Plug.Session])
# Use the session plug with the table name
plug Plug.Session, store: :mnemonix, key: "sid", store: My.Plug.Session
Link to this section Summary
Functions
Removes the session associated with given session id from the store
Parses the given cookie
Initializes the store
Stores the session associated with given session id
Link to this section Functions
delete(Plug.Conn.t(), Plug.Session.Store.sid(), Plug.opts()) :: :ok
Removes the session associated with given session id from the store.
Callback implementation for Plug.Session.Store.delete/3
.
get(Plug.Conn.t(), Plug.Session.Store.sid(), Mnemonix.store()) :: {Plug.Session.Store.sid(), Plug.Session.Store.session()}
Parses the given cookie.
Returns a session id and the session contents. The session id is any value that can be used to identify the session by the store.
The session id may be nil in case the cookie does not identify any value in the store. The session contents must be a map.
Callback implementation for Plug.Session.Store.get/3
.
Initializes the store.
The options returned from this function will be given
to get/3
, put/4
and delete/3
.
Callback implementation for Plug.Session.Store.init/1
.
put(Plug.Conn.t(), Plug.Session.Store.sid(), Plug.Session.Store.session(), Mnemonix.store()) :: Plug.Session.Store.sid()
Stores the session associated with given session id.
If nil
is given as id, a new session id should be
generated and returned.
Callback implementation for Plug.Session.Store.put/4
.