In this chapter, we applied different OTP constructs to our ElixirDrip application and we are now able to tackle a broader array of problems armed with this new set of tools. These tools are not fully-fledged solutions or frameworks, but rather tools that help you build your applications, not getting in the way. Elixir also sports the mantra of providing tools, not solutions, an expression coined by Robert Virding, one of the creators of Erlang.
This chapter highlighted some of the great tools Elixir puts at your disposal. A lot has been said, and many different concepts were introduced:
- We started by implementing a
GenServer
-based cache worker to keep the most recent media in memory for faster access. To keep the memory usage in check, we decided to expire the cache process after a while, and we achieved this by sending a delayed:expire
message to the process. - We also analyzed the simpler,
GenServer
-based,Agent
abstraction, for those cases when we just need to spawn a process to store...