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]).
%...