Skip to Main Content
Mastering Elixir
book

Mastering Elixir

by André Albuquerque, Daniel Caixinha
July 2018
Intermediate to advanced content levelIntermediate to advanced
574 pages
14h 7m
English
Packt Publishing
Content preview from Mastering Elixir

Using (D)ETS

In the previous section, we implemented the ElixirDrip text search functionality by using Task.async_stream/5 to search several text files at the same time. The text search function lived on the ElixirDrip.Storage.Search module and its last iteration could be used like this:

iex> alias ElixirDrip.Storage.Searchiex> media_ids = ["25", "8", "6", "7"]iex> search_expression = "media"iex> Search.safe_task_stream_search_for(media_ids, search_expression)%{  "6" => [{1, "Content of media 6."}],  "7" => [{1, "Content of media 7."}],  "8" => [{1, "Content of media 8."}]}

It returned a map with entries for every searched file whose search ended on the allotted time. For each media id, it yields a list of two-element tuples, where the first ...

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.
Start your free trial

You might also like

Testing Elixir

Testing Elixir

Andrea Leopardi, Jeffrey Matthias

Publisher Resources

ISBN: 9781788472678Supplemental Content