I need to implement pull to refresh in an iOS app, and I came across this thing, in where I don't know how to approach the problem with the best practices of DDD.
The presentation layer has an event to refresh a list, this needs to update the results throwing away the cache and fetching the elements from the backend.
In the Domain layer, my use case talks to a repository, but, since caching is an implementation detail, the repository interface does not expose a 'cleanCache' method, so there is no clean way to refresh cache from a use case. this is more or less the file structure that I have
Domain
- GetAllTodosUseCase
- TodosRepository (interface)
Infrastructure
- InMemoryTodosRepository (cache)
- RemoteTodosRepository (api)
- InMemoryWithRemoteTodosRepository (composes cache and api)
Application
- factories
Presentation
- UI (talks to an interactor interface)