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 ...