Skip to content

Instantly share code, notes, and snippets.

@Shemeikka
Created November 8, 2016 18:36
Show Gist options
  • Save Shemeikka/11f196884212dc650e828c2f71c4bddf to your computer and use it in GitHub Desktop.
Save Shemeikka/11f196884212dc650e828c2f71c4bddf 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