In general I’d prefer Cachex instead of a GenServer since it is backed by :ets
. That means that if the data is already cached (and fresh) then the reads don’t need to be serialized through a GenServer resulting in higher performance. Also I think there are a lot of correctness guarantees that are solved by Cachex already that you’d have to re-implement in a custom GenServer.
3 Likes