C
C#4mo ago
Alex

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
SpReeD
SpReeD4mo ago
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.
No description
SpReeD
SpReeD4mo ago
If you plan to use some caching, like redis/nosql it's wise to use some kind of IPC, for instance a bus-system.
Alex
Alex4mo ago
Thank you for the information