after look this
i plan use Cachex to cache data,
i will update the cache in other thread, like from websocket connection thread,
then use Quantum to maintain Cahcex data
Sounds good yeah, but if your cache doesn’t need to expire then just using ETS straight should be fine (Cachex basically adds functionality for elapsing cache’s and such from ETS).
However, if your data is time elapsing anyway, forgo Quantum and just have Cachex purge data when it’s X minutes old or as needed.
Put all access to the database in it’s own module, use just a database first. If it is shown to be an actual bottleneck later then you can put something like Cachex access in that module without changing the interface. Remember, you can’t really have too many modules.
But yeah, this is all the Don't prematurely optimize kind of thing. ^.^
Instead just abstract it out behind more functions so you can change the inner implementation as you need.
Okay, Yes, i understand what you mean,
Thank you very much for your suggestion,
I will follow your suggestions to implement, and then decide to add Cache or not