Erlang - Global Variables .. yes I know, I know

I GOT IT!!

Wish the docs, would say this under the lookup function.. Better yet, everyone who writes tutorials on ets, or more so books

The solution is to

TableID = ets:new(tb, [set,public,named_table])

That named_table is the important part

Some digging through man pages, but

;)


The correct answer to your problem is to not use a global table at all, but to rather pass around the information. Especially since you mention efficiency in your original question. You are creating a congestion point in your code which will make it have worse performance on any multi core machine.

The ets table is implemented as a process that all other processes have to call to get a value.

Tags:

Erlang

Global