Disk-based ETS
There may be scenarios where you want the information stored on the ETS table to be persisted in disk. You lose the performance of an in-memory data structure, but you get your information stored to disk if anything goes south. To cater for this case, Erlang provides DETS, a disk-based ETS solution that abides almost completely to the same ETS contract you already know and expect. You can't use it if you need an :ordered_set table since you're limited to 2 GB of data; instead, you will have to start it in a different way and properly close it, and that's essentially it.
Let's now implement a FlexibleSearchCacheWorker module that, depending on the argument passed to its start_link/1 function, uses a DETS or an ETS to store search ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access