Safe, Sequential And Scalable Counters In Mnesia

前端 未结 4 1481
旧时难觅i
旧时难觅i 2021-02-11 04:44

I am writing an application in Erlang/OTP and want to use sequential counters on a version recording system.

I first implemented them with

mnesia:dirty_update_count         


        
4条回答
  •  梦如初夏
    2021-02-11 05:28

    I was going to suggest an erlang process that serves up numbers for you. Since erlang processes messages sequentially you would be guaranteed of getting them in order. Persisting them would be necessary somewhow. The RabbitMQ suggestion above is one way but if you feel like it's overkill then just having the process store to a file periodically should be sufficient. A gen_server should be sufficient for your purposes.

提交回复
热议问题