Open seriyps opened 10 years ago
Lookup directly...hm I wonder if someone running gettext in a distributed setting where the server only runs on a specific node? I don't remember how Klarna (a big user of gettext) does.
I think, it may be optional, by setting flags in gettext_server's process dictionary like
key2str(Server, Key, Lang) ->
case proplists:get_value(public_table, erlang:process_info(Server, dictionary)) of
undefined ->
gen_server:call(Server, ...);
Tid ->
ets:lookup(Tid, ...)
end.
Which is quite fast and don't require any message-passing.
I would be very cautious to add anything hidden under key2str/3 since it is really heavily called in large systems such as Klarnas. I don't like the proplists module at all, and doing a process_info call, involving another process, may have uncertain side effects (e.g being re-scheduled?).
Add
{read_concurrency, true}
option to ETS table and lookup it directly, bypasinggen_server:call
. This may be done without any API changes.