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

Martin Dimitrov mrtndimitrov@REDACTED
Wed Oct 23 14:06:32 CEST 2013


Thanks for the replies. I will pass the update procedure thru a gen_server.

Regards,
Martin

On 10/23/2013 2:18 PM, Jesper Louis Andersen wrote:
> 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.
> 
> 




More information about the erlang-questions mailing list