GenServer.handle_cast
handle_cast
, go back to GenServer module for more information.
Specs
handle_cast(request :: term(), state :: term()) :: {:noreply, new_state} | {:noreply, new_state, timeout() | :hibernate | {:continue, term()}} | {:stop, reason :: term(), new_state} when new_state: term()
Invoked to handle asynchronous cast/2
messages.
request
is the request message sent by a cast/2
and state
is the current
state of the GenServer
.
Returning {:noreply, new_state}
continues the loop with new state new_state
.
Returning {:noreply, new_state, timeout}
is similar to {:noreply, new_state}
except that it also sets a timeout. See the "Timeouts" section in the module
documentation for more information.
Returning {:noreply, new_state, :hibernate}
is similar to
{:noreply, new_state}
except the process is hibernated before continuing the
loop. See handle_call/3
for more information.
Returning {:noreply, new_state, {:continue, continue}}
is similar to
{:noreply, new_state}
except handle_continue/2
will be invoked
immediately after with the value continue
as first argument.
Returning {:stop, reason, new_state}
stops the loop and terminate/2
is
called with the reason reason
and state new_state
. The process exits with
reason reason
.
This callback is optional. If one is not implemented, the server will fail if a cast is performed against it.