samedi 26 septembre 2020

Clean Architecture - obtaining cached data while refreshing it using repository pattern and use cases

I have one question of best practice. I'm trying to apply Clean Architecture in a sample app using MVVM. My question is, if ViewModel is supposed to call the use cases instead of calling directly the Repository (which has access to database and the API), but I want to display the cached results while the information is being refresh, how is supposed the ViewModel to access to the cached data if it's using the use case and not the repository?

I read this post and Android official doc but I'm not sure which is the best way of achieving this behaviour.

Aucun commentaire:

Enregistrer un commentaire