Agent.get

You're seeing just the function get, go back to Agent module for more information.
Link to this function

get(agent, fun, timeout \\ 5000)

View Source

Specs

get(agent(), (state() -> a), timeout()) :: a when a: var

Gets an agent value via the given anonymous function.

The function fun is sent to the agent which invokes the function passing the agent state. The result of the function invocation is returned from this function.

timeout is an integer greater than zero which specifies how many milliseconds are allowed before the agent executes the function and returns the result value, or the atom :infinity to wait indefinitely. If no result is received within the specified time, the function call fails and the caller exits.

Examples

iex> {:ok, pid} = Agent.start_link(fn -> 42 end)
iex> Agent.get(pid, fn state -> state end)
42
Link to this function

get(agent, module, fun, args, timeout \\ 5000)

View Source

Specs

get(agent(), module(), atom(), [term()], timeout()) :: any()

Gets an agent value via the given function.

Same as get/3 but a module, function, and arguments are expected instead of an anonymous function. The state is added as first argument to the given list of arguments.