Agents
Understand agents as background processes in Elixir.
We'll cover the following...
Introduction
An agent is a background process that maintains a state. We can access this state at different places within a process, within a node, or across multiple nodes. A function sets the initial state we pass when we start the agent.
We can interrogate the state using Agent.get
, passing it the agent descriptor and a function. The agent runs the function on its current state and returns the result.
We can also use Agent.update
to change the state held by ...