[erlang-questions] ets unique insert

Ulf Wiger (TN/EAB) <>
Mon Apr 23 11:40:38 CEST 2007


 
Chandru wrote:
> 
> Hello OTP team,
> 
> It will be nice to have a feature in ETS where for a 
> set/ordered_set table, an object is inserted into the table 
> only if an object with the same key doesn't already exist. 
> Without this feature, a lot of times I find myself writing 
> code where I am accessing a gen_server only to make sure a 
> key hasn't already been used which makes that gen_server 
> process a bottleneck in the system.
> 
> Is this possible? The operation could probably be called ets:create/2


...or ets:insert_new(Tab, Obj).  (:

See erl -man ets


BR,
Ulf W




More information about the erlang-questions mailing list