Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save unixc3t/1cbb7abcfbe51ec109ea9633c86b3e99 to your computer and use it in GitHub Desktop.
Save unixc3t/1cbb7abcfbe51ec109ea9633c86b3e99 to your computer and use it in GitHub Desktop.
Elixir Genserver callbacks and return values
# GenServer callbacks and return values
## init(args)
{:ok, state}
{:ok, state, timeout}
:ignore
{:stop, reason}
## handle_call(msg, {from, ref}, state)
{:reply, reply, state}
{:reply, reply, state, timeout}
{:reply, reply, state, :hibernate}
{:noreply, state}
{:noreply, state, timeout}
{:noreply, state, :hibernate}
{:stop, reason, reply, state}
{:stop, reason, state}
## handle_cast(msg, state)
{:noreply, state}
{:noreply, state, timeout}
{:noreply, state, :hibernate}
{:stop, reason, state}
## handle_info(msg, state)
{:noreply, state}
{:noreply, state, timeout}
{:stop, reason, state}
## terminate(reason, state)
:ok
## code_change(old_vsn, state, extra)
{:ok, new_state}
{:error, reason}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment