Nadia.SessionStore.ETS (nadia v1.5.0)

View Source

Local ETS-backed session store for Nadia bot handlers.

Nadia.SessionStore.ETS is an explicit, supervised process. It owns a private ETS table and implements Nadia.SessionStore for local development and simple single-node bots.

{:ok, pid} = Nadia.SessionStore.ETS.start_link([])
store = {Nadia.SessionStore.ETS, pid}
Nadia.SessionStore.put(store, {:chat, 123}, %{step: :waiting_for_name})

For application supervision, prefer a registered process name:

children = [
  {Nadia.SessionStore.ETS, name: MyApp.BotSessions}
]

store = {Nadia.SessionStore.ETS, MyApp.BotSessions}

This store is not persistent or distributed. Use a custom Nadia.SessionStore backend when sessions must survive restarts or be shared across nodes.

Summary

Functions

Starts a local ETS session store.

Types

option()

@type option() :: {:name, GenServer.name()} | {:id, term()}

Functions

start_link(opts \\ [])

@spec start_link([option()]) :: GenServer.on_start()

Starts a local ETS session store.