Behaviour for session-scoped state backends.
FastestMCP keeps session lifecycle in the runtime-owned session process, but the actual user-facing state can live in a pluggable backend. That split lets the runtime keep idle expiry and subscription tracking local while making the storage strategy configurable.
The built-in memory backend stores ordinary Elixir terms and is started once per running server. Custom backends can impose stricter serialization or persistence guarantees as long as they implement this behaviour.
Summary
Functions
Deletes one session value from the configured backend.
Deletes all state for the given session from the configured backend.
Reads one session value from the configured backend.
Stores one session value in the configured backend.
Types
Callbacks
@callback delete(store_ref(), session_id(), key()) :: :ok | {:error, term()}
@callback delete_session(store_ref(), session_id()) :: :ok | {:error, term()}
@callback get(store_ref(), session_id(), key()) :: {:ok, value()} | :error | {:error, term()}
@callback put(store_ref(), session_id(), key(), value()) :: :ok | {:error, term()}
@callback start_link(keyword()) :: GenServer.on_start()
Functions
Deletes one session value from the configured backend.
Deletes all state for the given session from the configured backend.
Reads one session value from the configured backend.
Stores one session value in the configured backend.