Forked from Shemeikka/gist:11f196884212dc650e828c2f71c4bddf
Created
August 3, 2019 07:23
-
-
Save unixc3t/1cbb7abcfbe51ec109ea9633c86b3e99 to your computer and use it in GitHub Desktop.
Elixir Genserver callbacks and return values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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