Help refactor service
Hi! I have data of many
Station
models. Their information updates every ~60 minutes. I need to store current data in cache (Redis) and history of data in database (MongoDb). I get data from 3rd party api and I have method that sends http request to it. Right now I have method to fetch data from 3rd party api, method to map it and method to save it to cache and get it from cache. I want to create new methods to save and get data from MongoDb. Should I create these methods in one service or in separate? What the best way to organize them?3 Replies
This is an architectural question, it depends what your entire project is about and which services are made public. Usually you go by the micro-service architecture, where you create a service for every thing, plus it's scalable with a loadbalancer later on.
If you plan to use some caching, like redis/nosql it's wise to use some kind of IPC, for instance a bus-system.
Thank you for the information