Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

ets tables are the goto for data structures (for example the :digraph module that ships with elixir is built on an ets table, presumably because A* needs a mutable datatype)

Process dictionary is also an option.

Can always use a genserver as a data store (but only do that if lifetime shenanigans make it make sense)

Postgres is also an option. Sqlite if you don't want to stand up a service.



Ah yes. I’m using a genserver to persist a countdown clock across page loads.

ETS gives me a memory leak vibe but I need to bite the bullet and learn to use it properly.


Think of ets as an arena. You can clear the whole table by yanking its owning process. This could even be made automatic by linking it to whatever process needs the ets table.


Hmmm. Maybe I’m misremembering some Erlang release notes then.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: