gen_server call when return value isn't wanted

James Aimonetti james@REDACTED
Fri Feb 11 04:37:15 CET 2011


I have a gen_server function, that as part of the body does a DB save, 
and returns the saved version of the data.

save_data(Data) ->
   gen_server:call(?SERVER, {save_data, Data}).

Occasionally I don't care about the result of the save and was wondering 
about couple of ideas.

Is there a difference to the compiler in doing

...
my_server:save_data(Stuff),
...

versus
...
_ = my_server:save_data(Stuff),
...

or should I just create a version of save_data/1 that uses cast instead? 
Perhaps spawn the save_data/1 call?

-- 
James Aimonetti
Distributed Systems Engineer / DJ MC_

2600hz | http://2600hz.com
sip:james@REDACTED
tel: 415.886.7905



More information about the erlang-questions mailing list