Ussd.Cache.ETS (Ussd v0.2.0)

Copy Markdown View Source

Default Ussd.Cache implementation: a supervised GenServer owning a public, named ETS table.

Unlike the table the old Ussd.Record used directly, entries here carry a real expiry: reads lazily drop expired entries, and a periodic sweep (every config :ussd, :cache_sweep_interval, :timer.minutes(1), default one minute) reclaims sessions nobody ever explicitly closed - the previous implementation kept every session in memory forever unless the flow ended with an explicit "prompt" action.

Summary

Functions

Returns a specification to start this module under a supervisor.

Starts the cache's supervised GenServer. Accepts :sweep_interval (milliseconds) to override config :ussd, :cache_sweep_interval for this one process - normally you don't call this yourself; Ussd.Application starts it as part of the app's supervision tree.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

Starts the cache's supervised GenServer. Accepts :sweep_interval (milliseconds) to override config :ussd, :cache_sweep_interval for this one process - normally you don't call this yourself; Ussd.Application starts it as part of the app's supervision tree.