Saving multiple structures in gen_server state

How to store multiple structures / elements in gen_server state?

I want to keep a link to the ets table, as well as a queue and a counter (integer).

thank

+3
source share
2 answers

The gen_server state is just an arbitrary erlang member. Use what is most convenient (record, tuple, list, voice recorder, whatever)

+9
source

Use record?

-record(state, {table, queue, counter}).
+9
source

Source: https://habr.com/ru/post/1776776/


All Articles