Hi everyone,
I have a question regarding how to implement repository class in elixir. In this case I want to set/get from redis cache. So I intend to write the module as follow
RedisRepository
getOrders(filter)
getOrder(orderId)
addOrder(order)
deleteOrder(order)
…
and I intend to use Redix lib to talk to Redis and Redix require that you init a process (start_link(x,y,z)) and keep the connection(pid) so that we can use that conn to execute redis commands.
My problem is I don’t know where/how to init the Redix process and store it somewhere, so that I can use that connection in RedisRepository module to set/get data from redis.
I would appreciate if someone can help recommend an approach that adhere to otp/elixir best practices
Thank you so much