Tutorial by Examples

Here is an example of a service that greets people by the given name, and keeps track of how many users it encountered. See usage below. %% greeter.erl %% Greets people and counts number of times it did so. -module(greeter). -behaviour(gen_server). %% Export API Functions -export([start_link/0...
A gen_server is a specific finite state machine working like a server. gen_server can handle different type of event: synchronous request with handle_call asynchronous request with handle_cast other message (not defined in OTP specification) with handle_info Synchronous and asynchronous mess...
This source code create a simple key/value store service based on map Erlang datastructure. Firstly, we need to define all information concerning our gen_server: -module(cache). -behaviour(gen_server). % our API -export([start_link/0]). -export([get/1, put/2, state/0, delete/1, stop/0]). %...

Page 1 of 1