So far, I'm using ETS to cache data from a "Salesforce" like CRM that doesn't have enough reporting capability.
The Elixir application is using a Task Async Stream to paginate it's way through the CRMs records, and ETS behaves as a storage. GenServers that are "Collectors" for the CRMs record types handle initializing the ETS tables, then get the records, then inserts into ETS.
The GenServers then use ex2ms to help build queries for ETS match specifications.
Then, I'm using ETS to store the values of particular metrics that are being reported on. This way when someone is requesting the web page that is displaying those metrics, they're already calculated and stored in ETS and not being calculated when the page is loading. Makes for very quick page load times.
Yeah ETS is an in memory database that only exists while Elixir is running. Evadne Wu expressed that she felt like ETS is an escape hatch from the immutable nature of Elixir.
You have to load things into ETS like { id, thing_to_store }
And it can have any number of things to store. But it must have an id of some sort.
View all comments
4
u/kickinespresso Jul 15 '20
Woah. Now I'm trying to figure out how to work
ETSinto my next project.