I have an activity which contains 3 fragments which make a network call to fetch some data,for example user details.The calls made by the 3 fragments are independent of each other but are still pulling the same data. Suppose all 3 fragments request for the data at the same time but fragment 1 makes the call first,is there a way fragment 2 and fragment 3 can check that the call was made for the same data and use that data when the response comes in rather than making their own call for the same data.
For example fragment 1 and 2 pull a list of data and for each data item there is an associated person who's details need to be fetched .I have written code to cache the persons data locally but on the first run there is no cache in which case both fragments make the call to fetch the persons data,there is no relation between the 2 fragment except for the person details.
I am using retrofit and rxjava in my project.