elixir-todo-list/lib/todo/process_registry.ex

19 lines
375 B
Elixir
Raw Normal View History

2024-08-07 10:03:31 +02:00
defmodule Todo.ProcessRegistry do
def start_link do
IO.puts("Starting #{__MODULE__}.")
Registry.start_link(keys: :unique, name: __MODULE__)
end
def via_tuple(key) do
{:via, Registry, {__MODULE__, key}}
end
def child_spec(_) do
Supervisor.child_spec(
Registry,
id: __MODULE__,
start: {__MODULE__, :start_link, []}
)
end
end