[erlang-questions] Atomically updating a record in ETS table

Dmitry Kolesnikov dmkolesnikov@REDACTED
Wed Oct 23 13:12:48 CEST 2013


There is ets:update_element but it works with tuples only.

I am afraid that you need to handle write/update operation through server (gen_server).
For high-throughput, you might need to implement multiple servers with consistent hash schema.

Best Regards, 

On Oct 23, 2013, at 2:06 PM, Martin Dimitrov <mrtndimitrov@REDACTED> wrote:

> Hello everyone,
> I have an ETS table that contains records of the following format:
> {Key, List}
> For example, {key123, [a,b,c]}. Now I have to add to the list a new
> item, say 'd'. I have to select the record, add the new value to the
> list and replace the record with the new list. But how to do this
> atomically? Many processes might try to add an item to a record. Some
> sort of "critical section"?
> Thanks in advance,
> Martin
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list