3 ms·
A simple GenServer ( a OTP behaviour ) linked to an ETS ( erlang in memory data store ) table would do the trick. Basically, It receives by message the inserts,
by julienmarie 10y ago
A simple GenServer ( a OTP behaviour ) linked to an ETS ( erlang in memory data store ) table would do the trick. Basically, It receives by message the inserts, and once the counter reaches x or timer reaches y secs, it inserts in the db. Thinking about it, 20 lines of code is already a bit verbose for it :)
- devbug 10y agoIn Elixir, you can use GenStage. (In fact, I'm writing a GenStage consumer right now.)
- julienmarie 10y agoTrue. But haven't played with it yet. It seems nice and straightforward also.