Registry.update_value
You're seeing just the function
update_value
, go back to Registry module for more information.
Specs
update_value(registry(), key(), (value() -> value())) :: {new_value :: term(), old_value :: term()} | :error
Updates the value for key
for the current process in the unique registry
.
Returns a {new_value, old_value}
tuple or :error
if there
is no such key assigned to the current process.
If a non-unique registry is given, an error is raised.
Examples
iex> Registry.start_link(keys: :unique, name: Registry.UpdateTest)
iex> {:ok, _} = Registry.register(Registry.UpdateTest, "hello", 1)
iex> Registry.lookup(Registry.UpdateTest, "hello")
[{self(), 1}]
iex> Registry.update_value(Registry.UpdateTest, "hello", &(&1 + 1))
{2, 1}
iex> Registry.lookup(Registry.UpdateTest, "hello")
[{self(), 2}]