Ok, lets say i have a DataRepository class with the methods, getNames() and getStates(). lets say this data is stored in a webservice or database that is an expensive operation.
once the first query is run and returned, when a consumer asked for these methods its returned immediately as the results are cached in the DataRepository class.
the issue is, for the first call you would want to behavior to be async to avoid blocking on this expensive call. What is the best way to code this? Is the fact that this DataRepository class is doing both actual cross boundry retrieving and caching breaking Single Respnosibility Principle.
any other thoughts on best practices here?