[erlang-questions] Atomically updating a record in ETS table
Jesper Louis Andersen
jesper.louis.andersen@REDACTED
Wed Oct 23 13:18:24 CEST 2013
On Wed, Oct 23, 2013 at 1:06 PM, Martin Dimitrov <mrtndimitrov@REDACTED>wrote:
> 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?
>
In this case, you may want to look at the "bag" table type, or perhaps
"duplicate bag". It will almost always be a better representation than
having to run the overhead of copying your list back and forth between a
process and ETS. Dmitry's suggestion is good as well. Serialize writes to
the table through a single process.
--
J.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131023/184d15b6/attachment.htm>
More information about the erlang-questions
mailing list